Merge branch 'enhancement-rfsim' into ru_rau_enhancement
Conflicts: cmake_targets/build_oai openair1/PHY/LTE_ESTIMATION/lte_sync_time.c openair1/PHY/LTE_TRANSPORT/dci_tools.c openair1/PHY/LTE_TRANSPORT/if4_tools.c openair1/PHY/LTE_TRANSPORT/prach.c openair1/PHY/defs_eNB.h openair1/PHY/impl_defs_lte.h openair2/ENB_APP/enb_config.c openair2/LAYER2/MAC/eNB_scheduler.c openair2/LAYER2/MAC/eNB_scheduler_ulsch.c targets/RT/USER/lte-enb.c targets/RT/USER/lte-ru.c targets/SIMU/USER/channel_sim.c targets/SIMU/USER/oaisim.c targets/SIMU/USER/oaisim_config.c targets/SIMU/USER/oaisim_functions.c
This commit is contained in:
+243
-383
File diff suppressed because it is too large
Load Diff
+126
-140
@@ -68,6 +68,7 @@ DISABLE_LOG_X="False"
|
||||
USRP_REC_PLAY="False"
|
||||
BUILD_ECLIPSE=0
|
||||
UE_NAS_USE_TUN="False"
|
||||
BASIC_SIMULATOR=0
|
||||
trap handle_ctrl_c INT
|
||||
|
||||
function print_help() {
|
||||
@@ -110,8 +111,6 @@ Options
|
||||
-t | --transport protocol
|
||||
ETHERNET , None
|
||||
Adds this trasport protocol support in compilation
|
||||
--oaisim
|
||||
Makes the oaisim simulator. Hardware will be defaulted to \"None\".
|
||||
--phy_simulators
|
||||
Makes the unitary tests Layer 1 simulators
|
||||
--core_simulators
|
||||
@@ -123,12 +122,12 @@ Options
|
||||
-V | --vcd
|
||||
Adds a debgging facility to the binary files: GUI with major internal synchronization events
|
||||
-x | --xforms
|
||||
Adds a software oscilloscope feature to the produced binaries. If oaisim, then enable PRINT_STATS.
|
||||
Adds a software oscilloscope feature to the produced binaries.
|
||||
--install-system-files
|
||||
Install OpenArInterface required files in Linux system
|
||||
(will ask root password)
|
||||
--noS1
|
||||
Compiles oaisim or lte-softmodem without S1 interface, using direct link to IP instead
|
||||
Compiles lte-softmodem without S1 interface, using direct link to IP instead
|
||||
--verbose-compile
|
||||
Shows detailed compilation instructions in makefile
|
||||
--cflags_processor
|
||||
@@ -159,12 +158,12 @@ Options
|
||||
Build for I/Q record-playback modes
|
||||
--ue-nas-use-tun
|
||||
Use TUN devices for the UEs instead of ue_ip.ko
|
||||
--basic-simulator
|
||||
Generates a basic [1 UE + 1 eNB + no channel] simulator.
|
||||
See targets/ARCH/tcp_bridge/README.tcp_bridge_oai for documentation.
|
||||
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
|
||||
NI/ETTUS B201 + COTS UE : ./build_oai -I --eNB -x --install-system-files -w USRP
|
||||
Usage (Regular):
|
||||
oaisim : ./build_oai --oaisim -x
|
||||
Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x
|
||||
NI/ETTUS B201 + OAI ENB : ./build_oai --eNB -x -w USRP"
|
||||
}
|
||||
@@ -246,10 +245,6 @@ function main() {
|
||||
echo_info "Setting transport protocol to: $TP"
|
||||
fi
|
||||
shift 2;;
|
||||
--oaisim)
|
||||
oaisim=1
|
||||
echo_info "Will compile oaisim and drivers nasmesh, ..."
|
||||
shift;;
|
||||
--phy_simulators)
|
||||
SIMUS_PHY=1
|
||||
echo_info "Will compile dlsim, ulsim, ..."
|
||||
@@ -354,6 +349,10 @@ function main() {
|
||||
UE_NAS_USE_TUN="True"
|
||||
echo_info "Enabling UE NAS TUN device usage instead of ue_ip.ko"
|
||||
shift 1;;
|
||||
--basic-simulator)
|
||||
BASIC_SIMULATOR=1
|
||||
echo_info "Compiling the basic simulator"
|
||||
shift 1;;
|
||||
-h | --help)
|
||||
print_help
|
||||
exit 1;;
|
||||
@@ -482,16 +481,6 @@ function main() {
|
||||
check_install_additional_tools
|
||||
fi
|
||||
|
||||
if [ "$oaisim" = "1" ] ; then
|
||||
#to be discussed
|
||||
# there is no RF device transport protocol
|
||||
HW="None"
|
||||
TP="ETHERNET"
|
||||
|
||||
if [ "$XFORMS" == "True" ] ; then
|
||||
PRINT_STATS="True"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo_info "3. building the compilation directives ..."
|
||||
@@ -681,125 +670,6 @@ function main() {
|
||||
cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
|
||||
fi
|
||||
|
||||
# oaisim compilation
|
||||
###############
|
||||
if [ "$oaisim" = "1" ] ; then
|
||||
dconf=$OPENAIR_DIR/targets/bin
|
||||
if [ "$NOS1" = "1" ] ; then
|
||||
oaisim_build_dir=oaisim_noS1_build_oai
|
||||
oaisim_exec=oaisim_nos1
|
||||
else
|
||||
oaisim_build_dir=oaisim_build_oai
|
||||
oaisim_exec=oaisim
|
||||
fi
|
||||
|
||||
echo_info "Compiling $oaisim_exec ($oaisim_build_dir)"
|
||||
cmake_file=$DIR/$oaisim_build_dir/CMakeLists.txt
|
||||
cp $DIR/$oaisim_build_dir/CMakeLists.template $cmake_file
|
||||
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
|
||||
echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file
|
||||
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
|
||||
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
|
||||
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
|
||||
echo "set ( UE_NAS_USE_TUN $UE_NAS_USE_TUN )" >> $cmake_file
|
||||
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
|
||||
[ "$CLEAN" = "1" ] && rm -rf $DIR/$oaisim_build_dir/build
|
||||
mkdir -p $DIR/$oaisim_build_dir/build
|
||||
cd $DIR/$oaisim_build_dir/build
|
||||
eval $CMAKE_CMD
|
||||
compilations \
|
||||
$oaisim_build_dir $oaisim_exec \
|
||||
$oaisim_exec $dbin/$oaisim_exec.$REL
|
||||
compilations \
|
||||
$oaisim_build_dir $config_libconfig_shlib \
|
||||
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
|
||||
compilations \
|
||||
$oaisim_build_dir coding \
|
||||
libcoding.so $dbin/libcoding.so
|
||||
|
||||
|
||||
if [ "$NOS1" != "1" ] ; then
|
||||
|
||||
[ "$CLEAN" = "1" ] && rm -rf $DIR/at_commands/build
|
||||
echo_info "Compiling at_nas_ue"
|
||||
mkdir -p $DIR/at_commands/build
|
||||
cd $DIR/at_commands/build
|
||||
eval $CMAKE_CMD
|
||||
compilations \
|
||||
at_commands at_nas_ue \
|
||||
at_nas_ue $dbin/at_nas_ue
|
||||
|
||||
# ue_ip driver compilation
|
||||
echo_info "Compiling UE specific part (ue_ip driver and usim tools)"
|
||||
compilations \
|
||||
oaisim_build_oai ue_ip \
|
||||
CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
|
||||
|
||||
[ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
|
||||
mkdir -p $DIR/nas_sim_tools/build
|
||||
cd $DIR/nas_sim_tools/build
|
||||
eval $CMAKE_CMD
|
||||
compilations \
|
||||
nas_sim_tools usim \
|
||||
usim $dbin/usim
|
||||
compilations \
|
||||
nas_sim_tools nvram \
|
||||
nvram $dbin/nvram
|
||||
compilations \
|
||||
nas_sim_tools conf2uedata \
|
||||
conf2uedata $dbin/conf2uedata
|
||||
|
||||
# generate USIM data
|
||||
if [ -f $dbin/conf2uedata ]; then
|
||||
install_nas_tools $conf_nvram_path $gen_nvram_path
|
||||
else
|
||||
echo_warning "not generated UE NAS files: binaries not found"
|
||||
fi
|
||||
else
|
||||
|
||||
compilations \
|
||||
$oaisim_build_dir rb_tool \
|
||||
rb_tool $dbin/rb_tool
|
||||
|
||||
# nasmesh driver compilation
|
||||
compilations \
|
||||
$oaisim_build_dir nasmesh \
|
||||
CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
|
||||
|
||||
#oai_nw_drv
|
||||
#compilations \
|
||||
# $oaisim_build_dir oai_nw_drv \
|
||||
# CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko
|
||||
fi
|
||||
|
||||
if [ "$TP" == "ETHERNET" ] ; then
|
||||
compilations \
|
||||
$oaisim_build_dir oai_eth_transpro \
|
||||
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
|
||||
ln -sf liboai_eth_transpro.so liboai_transpro.so
|
||||
ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
|
||||
echo_info "liboai_transpro.so is linked with ETHERNET library"
|
||||
fi
|
||||
|
||||
cmake_file=$DIR/oaisim_mme_build_oai/CMakeLists.txt
|
||||
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
|
||||
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
|
||||
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
|
||||
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
|
||||
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
|
||||
#[ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_mme_build_oai/build
|
||||
#mkdir -p $DIR/oaisim_mme_build_oai/build
|
||||
#cd $DIR/oaisim_mme_build_oai/build
|
||||
#eval $CMAKE_CMD
|
||||
#compilations \
|
||||
# oaisim_mme_build_oai oaisim_mme \
|
||||
# oaisim_mme $dbin/oaisim_mme.$REL
|
||||
fi
|
||||
|
||||
# Telnet server compilation
|
||||
#####################
|
||||
if [ "$BUILD_TELNETSRV" = "1" ] ; then
|
||||
@@ -920,6 +790,122 @@ fi
|
||||
else
|
||||
echo_info "10. Bypassing the Tests ..."
|
||||
fi
|
||||
|
||||
# basic simulator
|
||||
#####################
|
||||
if [ "$BASIC_SIMULATOR" = "1" ]; then
|
||||
echo_info "Build basic simulator"
|
||||
[ "$CLEAN" = "1" ] && rm -rf $OPENAIR_DIR/cmake_targets/basic_simulator
|
||||
[ "$CLEAN" = "1" ] && rm -rf $OPENAIR_DIR/cmake_targets/nas_sim_tools/build
|
||||
mkdir -p $OPENAIR_DIR/cmake_targets/basic_simulator
|
||||
mkdir -p $OPENAIR_DIR/cmake_targets/basic_simulator/enb
|
||||
mkdir -p $OPENAIR_DIR/cmake_targets/basic_simulator/ue
|
||||
mkdir -p $OPENAIR_DIR/cmake_targets/nas_sim_tools/build
|
||||
|
||||
# enb
|
||||
|
||||
cmake_file=$OPENAIR_DIR/cmake_targets/basic_simulator/enb/CMakeLists.txt
|
||||
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
|
||||
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
|
||||
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
|
||||
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
|
||||
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
|
||||
echo "set ( XFORMS $XFORMS )" >> $cmake_file
|
||||
echo "set ( RF_BOARD \"OAI_USRP\")" >> $cmake_file
|
||||
echo "set ( TRANSP_PRO \"None\")" >> $cmake_file
|
||||
echo "set(PACKAGE_NAME \"simulator_enb\")" >> $cmake_file
|
||||
echo "set (DEADLINE_SCHEDULER \"False\" )" >> $cmake_file
|
||||
echo "set (CPU_AFFINITY \"False\" )" >> $cmake_file
|
||||
echo "set ( T_TRACER \"True\" )" >> $cmake_file
|
||||
echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file
|
||||
echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file
|
||||
echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file
|
||||
echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file
|
||||
echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file
|
||||
echo "set (BASIC_SIMULATOR \"True\" )" >> $cmake_file
|
||||
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)' >> $cmake_file
|
||||
|
||||
echo_info "Build eNB"
|
||||
echo_info "logs are in $dlog/basic_simulator_enb.txt"
|
||||
set +e
|
||||
{
|
||||
cd $OPENAIR_DIR/cmake_targets/basic_simulator/enb
|
||||
cmake .
|
||||
make -j`nproc` coding params_libconfig tcp_bridge_oai lte-softmodem
|
||||
ln -sf libtcp_bridge_oai.so liboai_device.so
|
||||
cd ../..
|
||||
} > $dlog/basic_simulator_enb.txt 2>&1
|
||||
set -e
|
||||
if [ -s $OPENAIR_DIR/cmake_targets/basic_simulator/enb/lte-softmodem -a \
|
||||
-s $OPENAIR_DIR/cmake_targets/basic_simulator/enb/libcoding.so -a \
|
||||
-s $OPENAIR_DIR/cmake_targets/basic_simulator/enb/libparams_libconfig.so -a \
|
||||
-s $OPENAIR_DIR/cmake_targets/basic_simulator/enb/libtcp_bridge_oai.so ] ; then
|
||||
echo_success "eNB compiled"
|
||||
check_warnings "$dlog/basic_simulator_enb.txt"
|
||||
else
|
||||
echo_error "eNB compilation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ue
|
||||
|
||||
echo_info "Compile conf2uedata"
|
||||
cd $OPENAIR_DIR/cmake_targets/nas_sim_tools/build
|
||||
eval $CMAKE_CMD
|
||||
compilations \
|
||||
nas_sim_tools conf2uedata \
|
||||
conf2uedata $dbin/conf2uedata
|
||||
|
||||
cmake_file=$OPENAIR_DIR/cmake_targets/basic_simulator/ue/CMakeLists.txt
|
||||
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
|
||||
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
|
||||
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
|
||||
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
|
||||
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
|
||||
echo "set ( XFORMS $XFORMS )" >> $cmake_file
|
||||
echo "set ( RF_BOARD \"OAI_USRP\")" >> $cmake_file
|
||||
echo "set ( TRANSP_PRO \"None\")" >> $cmake_file
|
||||
echo "set(PACKAGE_NAME \"simulator_ue\")" >> $cmake_file
|
||||
echo "set (DEADLINE_SCHEDULER \"False\" )" >> $cmake_file
|
||||
echo "set (CPU_AFFINITY \"False\" )" >> $cmake_file
|
||||
echo "set ( T_TRACER \"False\" )" >> $cmake_file
|
||||
echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file
|
||||
echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file
|
||||
echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file
|
||||
echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file
|
||||
echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file
|
||||
echo "set (LINUX True )" >> $cmake_file
|
||||
echo "set (PDCP_USE_NETLINK True )" >> $cmake_file
|
||||
echo "set (BASIC_SIMULATOR \"True\" )" >> $cmake_file
|
||||
echo "set (UE_NAS_USE_TUN \"True\" )" >> $cmake_file
|
||||
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)' >> $cmake_file
|
||||
|
||||
echo_info "Build UE"
|
||||
echo_info "logs are in $dlog/basic_simulator_ue.txt"
|
||||
set +e
|
||||
{
|
||||
cd $OPENAIR_DIR/cmake_targets/basic_simulator/ue
|
||||
cmake .
|
||||
make -j`nproc` coding params_libconfig tcp_bridge_oai lte-uesoftmodem
|
||||
ln -sf libtcp_bridge_oai.so liboai_device.so
|
||||
cd ../..
|
||||
} > $dlog/basic_simulator_ue.txt 2>&1
|
||||
set -e
|
||||
if [ -s $OPENAIR_DIR/cmake_targets/basic_simulator/ue/lte-uesoftmodem -a \
|
||||
-s $OPENAIR_DIR/cmake_targets/basic_simulator/ue/libcoding.so -a \
|
||||
-s $OPENAIR_DIR/cmake_targets/basic_simulator/ue/libparams_libconfig.so -a \
|
||||
-s $OPENAIR_DIR/cmake_targets/basic_simulator/ue/libtcp_bridge_oai.so ] ; then
|
||||
echo_success "UE compiled"
|
||||
check_warnings "$dlog/basic_simulator_ue.txt"
|
||||
else
|
||||
echo_error "UE compilation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo_info "Generate UE SIM data"
|
||||
$OPENAIR_DIR/targets/bin/conf2uedata -c $OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o $OPENAIR_DIR/cmake_targets/basic_simulator/ue
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -8,5 +8,5 @@ set(DEBUG_PHY False)
|
||||
set(MU_RECIEVER False)
|
||||
set(NAS_UE False)
|
||||
set(MESSAGE_CHART_GENERATOR False)
|
||||
|
||||
set(RRC_ASN1_VERSION "Rel14")
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
|
||||
|
||||
@@ -95,6 +95,7 @@ get_distribution_release() {
|
||||
check_supported_distribution() {
|
||||
local distribution=$(get_distribution_release)
|
||||
case "$distribution" in
|
||||
"ubuntu18.04") return 0 ;;
|
||||
"ubuntu17.10") return 0 ;;
|
||||
"ubuntu17.04") return 0 ;;
|
||||
"ubuntu16.04") return 0 ;;
|
||||
@@ -267,7 +268,7 @@ check_install_usrp_uhd_driver(){
|
||||
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
||||
#first we remove old installation
|
||||
$SUDO apt-get remove -y uhd || true
|
||||
$SUDO apt-get remove libuhd-dev libuhd003 uhd-host -y
|
||||
$SUDO apt-get remove libuhd-dev libuhd003 uhd-host -y || true
|
||||
v=$(lsb_release -cs)
|
||||
$SUDO apt-add-repository --remove "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
|
||||
#The new USRP repository
|
||||
@@ -488,19 +489,24 @@ check_install_oai_software() {
|
||||
$SUDO apt install -y software-properties-common
|
||||
case "$(get_distribution_release)" in
|
||||
"ubuntu14.04")
|
||||
specific_packages="libtasn1-3-dev gccxml libgnutls-dev libatlas-dev"
|
||||
specific_packages="libtasn1-3-dev gccxml libgnutls-dev libatlas-dev iproute libconfig8-dev"
|
||||
# For iperf3
|
||||
$SUDO add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports universe"
|
||||
$SUDO apt-get update
|
||||
;;
|
||||
"ubuntu16.04")
|
||||
specific_packages="libtasn1-6-dev gccxml libgnutls-dev libatlas-dev"
|
||||
specific_packages="libtasn1-6-dev gccxml libgnutls-dev libatlas-dev iproute libconfig8-dev"
|
||||
;;
|
||||
"ubuntu17.04")
|
||||
specific_packages="libtasn1-6-dev castxml libgnutls28-dev libatlas-dev"
|
||||
specific_packages="libtasn1-6-dev castxml libgnutls28-dev libatlas-dev iproute libconfig8-dev"
|
||||
;;
|
||||
"ubuntu17.10")
|
||||
specific_packages="libtasn1-6-dev castxml libgnutls28-dev"
|
||||
specific_packages="libtasn1-6-dev castxml libgnutls28-dev iproute libconfig8-dev"
|
||||
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
|
||||
LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
|
||||
;;
|
||||
"ubuntu18.04")
|
||||
specific_packages="libtasn1-6-dev castxml libgnutls28-dev iproute2 libconfig-dev"
|
||||
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
|
||||
LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
|
||||
;;
|
||||
@@ -524,12 +530,10 @@ check_install_oai_software() {
|
||||
gtkwave \
|
||||
guile-2.0-dev \
|
||||
iperf \
|
||||
iproute \
|
||||
iptables \
|
||||
iptables-dev \
|
||||
libatlas-base-dev \
|
||||
libblas-dev \
|
||||
libconfig8-dev \
|
||||
libffi-dev \
|
||||
libforms-bin \
|
||||
libforms-dev \
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
|
||||
#include <pthread.h>
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "PHY/impl_defs_lte.h"
|
||||
#include "RRC/LITE/defs.h"
|
||||
#include "RRC/LTE/rrc_defs.h"
|
||||
#include "flexran_agent_defs.h"
|
||||
|
||||
#include "gtpv1u.h"
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "gtpv1u_eNB_defs.h"
|
||||
|
||||
#include "PHY/defs_L1_NB_IoT.h"
|
||||
#include "RRC/LITE/defs_NB_IoT.h"
|
||||
#include "RRC/LTE/defs_NB_IoT.h"
|
||||
typedef struct {
|
||||
/// RAN context config file name
|
||||
char *config_file_name;
|
||||
|
||||
+11
-7
@@ -88,7 +88,7 @@ static void new_thread(void *(*f)(void *), void *data)
|
||||
|
||||
/* defined in local_tracer.c */
|
||||
void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
||||
int local_socket);
|
||||
int local_socket, char *shm_file);
|
||||
|
||||
/* We monitor the tracee and the local tracer processes.
|
||||
* When one dies we forcefully kill the other.
|
||||
@@ -113,6 +113,9 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
||||
int s;
|
||||
int T_shm_fd;
|
||||
int child1, child2;
|
||||
char shm_file[128];
|
||||
|
||||
sprintf(shm_file, "/%s%d", T_SHM_FILENAME, getpid());
|
||||
|
||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair))
|
||||
{ perror("socketpair"); abort(); }
|
||||
@@ -122,7 +125,8 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
||||
child1 = fork(); if (child1 == -1) abort();
|
||||
if (child1 == 0) {
|
||||
close(socket_pair[1]);
|
||||
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0]);
|
||||
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0],
|
||||
shm_file);
|
||||
exit(0);
|
||||
}
|
||||
close(socket_pair[0]);
|
||||
@@ -142,13 +146,13 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
|
||||
T_socket = s;
|
||||
|
||||
/* setup shared memory */
|
||||
T_shm_fd = shm_open(T_SHM_FILENAME, O_RDWR /*| O_SYNC*/, 0666);
|
||||
shm_unlink(T_SHM_FILENAME);
|
||||
if (T_shm_fd == -1) { perror(T_SHM_FILENAME); abort(); }
|
||||
T_shm_fd = shm_open(shm_file, O_RDWR /*| O_SYNC*/, 0666);
|
||||
shm_unlink(shm_file);
|
||||
if (T_shm_fd == -1) { perror(shm_file); abort(); }
|
||||
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, T_shm_fd, 0);
|
||||
if (T_cache == NULL)
|
||||
{ perror(T_SHM_FILENAME); abort(); }
|
||||
if (T_cache == MAP_FAILED)
|
||||
{ perror(shm_file); abort(); }
|
||||
close(T_shm_fd);
|
||||
|
||||
new_thread(T_receive_thread, NULL);
|
||||
|
||||
@@ -110,6 +110,16 @@ typedef struct {
|
||||
extern volatile int *T_freelist_head;
|
||||
extern T_cache_t *T_cache;
|
||||
|
||||
/* When running the basic simulator, we may fill the T cache too fast.
|
||||
* Let's not crash if it's full, just wait.
|
||||
*/
|
||||
#if BASIC_SIMULATOR
|
||||
# define T_BASIC_SIMULATOR_WAIT \
|
||||
while (T_cache[T_LOCAL_slot].busy) usleep(100)
|
||||
#else
|
||||
# define T_BASIC_SIMULATOR_WAIT /* */
|
||||
#endif
|
||||
|
||||
/* used at header of Tn, allocates buffer */
|
||||
#define T_LOCAL_DATA \
|
||||
char *T_LOCAL_buf; \
|
||||
@@ -118,6 +128,7 @@ extern T_cache_t *T_cache;
|
||||
T_LOCAL_slot = __sync_fetch_and_add(T_freelist_head, 1) \
|
||||
& (T_CACHE_SIZE - 1); \
|
||||
(void)__sync_fetch_and_and(T_freelist_head, T_CACHE_SIZE - 1); \
|
||||
T_BASIC_SIMULATOR_WAIT; \
|
||||
if (T_cache[T_LOCAL_slot].busy) { \
|
||||
printf("%s:%d:%s: T cache is full - consider increasing its size\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__); \
|
||||
|
||||
+12
-2
@@ -8,10 +8,20 @@
|
||||
#define T_MAX_ARGS 16
|
||||
|
||||
/* maximum size of a message - increase if needed */
|
||||
#define T_BUFFER_MAX (1024*64)
|
||||
#if BASIC_SIMULATOR
|
||||
/* let's have 100 RBs functional for the basic simulator */
|
||||
# define T_BUFFER_MAX (1024*64*2)
|
||||
#else
|
||||
# define T_BUFFER_MAX (1024*64)
|
||||
#endif
|
||||
|
||||
/* size of the local cache for messages (must be pow(2,something)) */
|
||||
#define T_CACHE_SIZE (8192 * 2)
|
||||
#if BASIC_SIMULATOR
|
||||
/* we don't need much space for the basic simulator */
|
||||
# define T_CACHE_SIZE 1024
|
||||
#else
|
||||
# define T_CACHE_SIZE (8192 * 2)
|
||||
#endif
|
||||
|
||||
/* maximum number of bytes a message can contain */
|
||||
#ifdef T_SEND_TIME
|
||||
|
||||
@@ -300,6 +300,20 @@ static void forward(void *_forwarder, char *buf, int size)
|
||||
if (f->tail != NULL) f->tail->next = new;
|
||||
f->tail = new;
|
||||
|
||||
#if BASIC_SIMULATOR
|
||||
/* When runnng the basic simulator, the tracer may be too slow.
|
||||
* Let's not take too much memory in the tracee and
|
||||
* wait if there is too much data to send. 200MB is
|
||||
* arbitrary.
|
||||
*/
|
||||
while (f->memusage > 200 * 1024 * 1024) {
|
||||
if (pthread_cond_signal(&f->cond)) abort();
|
||||
if (pthread_mutex_unlock(&f->lock)) abort();
|
||||
usleep(1000);
|
||||
if (pthread_mutex_lock(&f->lock)) abort();
|
||||
}
|
||||
#endif /* BASIC_SIMULATOR */
|
||||
|
||||
f->memusage += size+4;
|
||||
/* warn every 100MB */
|
||||
if (f->memusage > f->last_warning_memusage &&
|
||||
@@ -326,17 +340,17 @@ static void wait_message(void)
|
||||
while (T_local_cache[T_busylist_head].busy == 0) usleep(1000);
|
||||
}
|
||||
|
||||
static void init_shm(void)
|
||||
static void init_shm(char *shm_file)
|
||||
{
|
||||
int i;
|
||||
int s = shm_open(T_SHM_FILENAME, O_RDWR | O_CREAT /*| O_SYNC*/, 0666);
|
||||
if (s == -1) { perror(T_SHM_FILENAME); abort(); }
|
||||
int s = shm_open(shm_file, O_RDWR | O_CREAT /*| O_SYNC*/, 0666);
|
||||
if (s == -1) { perror(shm_file); abort(); }
|
||||
if (ftruncate(s, T_CACHE_SIZE * sizeof(T_cache_t)))
|
||||
{ perror(T_SHM_FILENAME); abort(); }
|
||||
{ perror(shm_file); abort(); }
|
||||
T_local_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, s, 0);
|
||||
if (T_local_cache == NULL)
|
||||
{ perror(T_SHM_FILENAME); abort(); }
|
||||
if (T_local_cache == MAP_FAILED)
|
||||
{ perror(shm_file); abort(); }
|
||||
close(s);
|
||||
|
||||
/* let's garbage the memory to catch some potential problems
|
||||
@@ -347,7 +361,7 @@ static void init_shm(void)
|
||||
}
|
||||
|
||||
void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
||||
int local_socket)
|
||||
int local_socket, char *shm_file)
|
||||
{
|
||||
int s;
|
||||
int port = remote_port;
|
||||
@@ -357,7 +371,7 @@ void T_local_tracer_main(int remote_port, int wait_for_tracer,
|
||||
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
|
||||
|
||||
init_shm();
|
||||
init_shm(shm_file);
|
||||
s = local_socket;
|
||||
|
||||
if (dont_wait) {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "gui/gui.h"
|
||||
#include "filter/filter.h"
|
||||
#include "utils.h"
|
||||
#include "../T_defs.h"
|
||||
#include "event_selector.h"
|
||||
#include "openair_logo.h"
|
||||
#include "config.h"
|
||||
@@ -875,6 +874,8 @@ int main(int n, char **v)
|
||||
if (pthread_mutex_init(&enb_data.lock, NULL)) abort();
|
||||
setup_event_selector(g, database, is_on, is_on_changed, &enb_data);
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
restart:
|
||||
clear_remote_config();
|
||||
enb_data.socket = connect_to(ip, port);
|
||||
@@ -884,9 +885,8 @@ restart:
|
||||
|
||||
/* read messages */
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(enb_data.socket, v, database);
|
||||
e = get_event(enb_data.socket, &ebuf, database);
|
||||
if (e.type == -1) goto restart;
|
||||
if (pthread_mutex_lock(&enb_data.lock)) abort();
|
||||
handle_event(h, e);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
event get_event(int socket, char *event_buffer, void *database)
|
||||
event get_event(int socket, OBUF *event_buffer, void *database)
|
||||
{
|
||||
#ifdef T_SEND_TIME
|
||||
struct timespec t;
|
||||
@@ -29,17 +29,23 @@ again:
|
||||
#endif
|
||||
if (fullread(socket, &type, sizeof(int)) == -1) goto read_error;
|
||||
length -= sizeof(int);
|
||||
if (fullread(socket, event_buffer, length) == -1) goto read_error;
|
||||
if (event_buffer->omaxsize < length) {
|
||||
event_buffer->omaxsize = (length + 65535) & ~65535;
|
||||
event_buffer->obuf = realloc(event_buffer->obuf, event_buffer->omaxsize);
|
||||
if (event_buffer->obuf == NULL) { printf("out of memory\n"); exit(1); }
|
||||
}
|
||||
if (fullread(socket, event_buffer->obuf, length) == -1) goto read_error;
|
||||
event_buffer->osize = length;
|
||||
|
||||
if (type == -1) append_received_config_chunk(event_buffer, length);
|
||||
if (type == -1) append_received_config_chunk(event_buffer->obuf, length);
|
||||
if (type == -2) verify_config();
|
||||
|
||||
if (type == -1 || type == -2) goto again;
|
||||
|
||||
#ifdef T_SEND_TIME
|
||||
return new_event(t, type, length, event_buffer, database);
|
||||
return new_event(t, type, length, event_buffer->obuf, database);
|
||||
#else
|
||||
return new_event(type, length, event_buffer, database);
|
||||
return new_event(type, length, event_buffer->obuf, database);
|
||||
#endif
|
||||
|
||||
read_error:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef _EVENT_H_
|
||||
#define _EVENT_H_
|
||||
|
||||
#include "utils.h"
|
||||
#include "../T_defs.h"
|
||||
#ifdef T_SEND_TIME
|
||||
#include <time.h>
|
||||
@@ -37,7 +38,7 @@ typedef struct {
|
||||
int ecount;
|
||||
} event;
|
||||
|
||||
event get_event(int s, char *v, void *d);
|
||||
event get_event(int s, OBUF *v, void *d);
|
||||
|
||||
#ifdef T_SEND_TIME
|
||||
event new_event(struct timespec sending_time, int type,
|
||||
|
||||
@@ -99,10 +99,11 @@ int main(int n, char **v)
|
||||
|
||||
found = 0;
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(fd, v, database);
|
||||
e = get_event(fd, &ebuf, database);
|
||||
if (e.type == -1) break;
|
||||
if (e.type != input_event_id) continue;
|
||||
for (i = 0; i < filter_count; i++)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "utils.h"
|
||||
#include "../T_defs.h"
|
||||
|
||||
void usage(void)
|
||||
@@ -35,14 +36,22 @@ int main(int n, char **v)
|
||||
in = fopen(input_filename, "r");
|
||||
if (in == NULL) { perror(input_filename); abort(); }
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
while (1) {
|
||||
int type;
|
||||
int32_t length;
|
||||
char v[T_BUFFER_MAX];
|
||||
char *v;
|
||||
int vpos = 0;
|
||||
|
||||
/* read event from file */
|
||||
if (fread(&length, 4, 1, in) != 1) break;
|
||||
if (ebuf.omaxsize < length) {
|
||||
ebuf.omaxsize = (length + 65535) & ~65535;
|
||||
ebuf.obuf = realloc(ebuf.obuf, ebuf.omaxsize);
|
||||
if (ebuf.obuf == NULL) { printf("out of memory\n"); exit(1); }
|
||||
}
|
||||
v = ebuf.obuf;
|
||||
memcpy(v+vpos, &length, 4);
|
||||
vpos += 4;
|
||||
#ifdef T_SEND_TIME
|
||||
|
||||
@@ -104,11 +104,12 @@ err:
|
||||
fd = open(file, O_RDONLY);
|
||||
if (fd == -1) { perror(file); exit(1); }
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
/* get wanted frame/subframe */
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(fd, v, database);
|
||||
e = get_event(fd, &ebuf, database);
|
||||
if (e.type == -1) break;
|
||||
if (e.type != input_event_id) continue;
|
||||
if (verbose)
|
||||
|
||||
@@ -100,10 +100,12 @@ err:
|
||||
int last_frame = -1;
|
||||
int last_subframe = -1;
|
||||
int subframe_written = 0;
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(fd, v, database);
|
||||
e = get_event(fd, &ebuf, database);
|
||||
if (e.type == -1) break;
|
||||
if (e.type != output_event_id) continue;
|
||||
if (verbose)
|
||||
|
||||
@@ -73,17 +73,22 @@ int main(int n, char **v)
|
||||
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
|
||||
abort();
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
char dump[10][T_BUFFER_MAX];
|
||||
event dump_ev[10];
|
||||
FILE *z = fopen("/tmp/dd", "w"); if (z == NULL) abort();
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
char *v;
|
||||
event e;
|
||||
e = get_event(socket, v, database);
|
||||
e = get_event(socket, &ebuf, database);
|
||||
v = ebuf.obuf;
|
||||
if (e.type == -1) break;
|
||||
if (e.type == ev_input) {
|
||||
int sf = e.e[2].i;
|
||||
memcpy(dump[sf], v, T_BUFFER_MAX);
|
||||
if (ebuf.osize > T_BUFFER_MAX)
|
||||
{ printf("event size too big\n"); exit(1); }
|
||||
memcpy(dump[sf], ebuf.obuf, ebuf.osize);
|
||||
dump_ev[sf] = e;
|
||||
printf("input %d/%d\n", e.e[1].i, sf);
|
||||
if (fwrite(dump_ev[sf].e[4].b, dump_ev[sf].e[4].bsize, 1, z) != 1) abort();
|
||||
|
||||
@@ -84,11 +84,12 @@ int main(int n, char **v)
|
||||
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
|
||||
abort();
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
int on_off;
|
||||
e = get_event(socket, v, database);
|
||||
e = get_event(socket, &ebuf, database);
|
||||
if (e.type == -1) break;
|
||||
if (e.type != ev_fun)
|
||||
{ printf("unhandled event %d\n", e.type); continue; }
|
||||
|
||||
@@ -246,11 +246,12 @@ int main(int n, char **v)
|
||||
|
||||
new_thread(receiver, &d);
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
/* read messages */
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(in, v, database);
|
||||
e = get_event(in, &ebuf, database);
|
||||
if (e.type == -1) break;
|
||||
if (!(e.type == ul_id || e.type == dl_id)) continue;
|
||||
handle_event(h, e);
|
||||
|
||||
@@ -123,14 +123,22 @@ int main(int n, char **v)
|
||||
if (signal(SIGINT, force_stop) == SIG_ERR) abort();
|
||||
if (signal(SIGTSTP, force_stop) == SIG_ERR) abort();
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
/* read messages */
|
||||
while (run) {
|
||||
int type;
|
||||
int32_t length;
|
||||
char v[T_BUFFER_MAX];
|
||||
char *v;
|
||||
int vpos = 0;
|
||||
|
||||
if (fullread(socket, &length, 4) == -1) goto read_error;
|
||||
if (ebuf.omaxsize < length) {
|
||||
ebuf.omaxsize = (length + 65535) & ~65535;
|
||||
ebuf.obuf = realloc(ebuf.obuf, ebuf.omaxsize);
|
||||
if (ebuf.obuf == NULL) { printf("out of memory\n"); exit(1); }
|
||||
}
|
||||
v = ebuf.obuf;
|
||||
memcpy(v+vpos, &length, 4);
|
||||
vpos += 4;
|
||||
#ifdef T_SEND_TIME
|
||||
|
||||
@@ -136,14 +136,22 @@ int main(int n, char **v)
|
||||
|
||||
new_thread(get_message_thread, &socket);
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
while (1) {
|
||||
int type;
|
||||
int32_t length;
|
||||
char v[T_BUFFER_MAX];
|
||||
char *v;
|
||||
int vpos = 0;
|
||||
|
||||
/* read event from file */
|
||||
if (fread(&length, 4, 1, in) != 1) break;
|
||||
if (ebuf.omaxsize < length) {
|
||||
ebuf.omaxsize = (length + 65535) & ~65535;
|
||||
ebuf.obuf = realloc(ebuf.obuf, ebuf.omaxsize);
|
||||
if (ebuf.obuf == NULL) { printf("out of memory\n"); exit(1); }
|
||||
}
|
||||
v = ebuf.obuf;
|
||||
memcpy(v+vpos, &length, 4);
|
||||
vpos += 4;
|
||||
#ifdef T_SEND_TIME
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "view/view.h"
|
||||
#include "gui/gui.h"
|
||||
#include "utils.h"
|
||||
#include "../T_defs.h"
|
||||
#include "event_selector.h"
|
||||
#include "config.h"
|
||||
|
||||
@@ -182,11 +181,12 @@ int main(int n, char **v)
|
||||
/* send the first message - activate selected traces */
|
||||
is_on_changed(&textlog_data);
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
/* read messages */
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(textlog_data.socket, v, database);
|
||||
e = get_event(textlog_data.socket, &ebuf, database);
|
||||
if (e.type == -1) abort();
|
||||
handle_event(h, e);
|
||||
}
|
||||
|
||||
@@ -287,11 +287,12 @@ int main(int n, char **v)
|
||||
if (signal(SIGINT, force_stop) == SIG_ERR) abort();
|
||||
if (signal(SIGTSTP, force_stop) == SIG_ERR) abort();
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
/* read messages */
|
||||
while (run) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(socket, v, database);
|
||||
e = get_event(socket, &ebuf, database);
|
||||
if (e.type == -1) { printf("disconnected? let's quit gently\n"); break; }
|
||||
handle_event(h, e);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "gui/gui.h"
|
||||
#include "filter/filter.h"
|
||||
#include "utils.h"
|
||||
#include "../T_defs.h"
|
||||
#include "event_selector.h"
|
||||
#include "openair_logo.h"
|
||||
#include "config.h"
|
||||
@@ -854,6 +853,8 @@ int main(int n, char **v)
|
||||
if (pthread_mutex_init(&ue_data.lock, NULL)) abort();
|
||||
setup_event_selector(g, database, is_on, is_on_changed, &ue_data);
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
restart:
|
||||
clear_remote_config();
|
||||
ue_data.socket = connect_to(ip, port);
|
||||
@@ -863,9 +864,8 @@ restart:
|
||||
|
||||
/* read messages */
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(ue_data.socket, v, database);
|
||||
e = get_event(ue_data.socket, &ebuf, database);
|
||||
if (e.type == -1) goto restart;
|
||||
if (pthread_mutex_lock(&ue_data.lock)) abort();
|
||||
handle_event(h, e);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "view/view.h"
|
||||
#include "gui/gui.h"
|
||||
#include "utils.h"
|
||||
#include "../T_defs.h"
|
||||
#include "event_selector.h"
|
||||
#include "config.h"
|
||||
|
||||
@@ -188,11 +187,12 @@ int main(int n, char **v)
|
||||
/* send the first message - activate selected traces */
|
||||
is_on_changed(&vcd_data);
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
/* read messages */
|
||||
while (1) {
|
||||
char v[T_BUFFER_MAX];
|
||||
event e;
|
||||
e = get_event(vcd_data.socket, v, database);
|
||||
e = get_event(vcd_data.socket, &ebuf, database);
|
||||
if (e.type == -1) abort();
|
||||
handle_event(h, e);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "log.h"
|
||||
|
||||
#if defined (LOG_D) && defined (LOG_E)
|
||||
# define SIG_DEBUG(x, args...) LOG_D(EMU, x, ##args)
|
||||
# define SIG_ERROR(x, args...) LOG_E(EMU, x, ##args)
|
||||
# define SIG_DEBUG(x, args...) LOG_D(SIM, x, ##args)
|
||||
# define SIG_ERROR(x, args...) LOG_E(SIM, x, ##args)
|
||||
#endif
|
||||
|
||||
#ifndef SIG_DEBUG
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <dlfcn.h>
|
||||
#include "openair1/PHY/defs.h"
|
||||
#include "openair1/PHY/defs_common.h"
|
||||
#define LOAD_MODULE_SHLIB_MAIN
|
||||
|
||||
#include "common/config/config_userapi.h"
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
Scenario 1 : Off-network UE2UE link
|
||||
SynchREF UE (UE1)
|
||||
|
||||
UE1(eth0 - 10.10.10.1)--------UE2(eno1 - 10.10.10.2)
|
||||
|
||||
Here's an example of /etc/network/interfaces configuration for UE1
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 10.10.10.1
|
||||
netmask 255.255.255.0
|
||||
gateway 10.10.10.1
|
||||
|
||||
Prepare the environment:
|
||||
- git clone https://gitlab.eurecom.fr/matzakos/LTE-D2D.git #branch: master
|
||||
This branch contains all the current development for DDPS
|
||||
- UE MAC<-> UE MAC for Scenario 1
|
||||
- eNB MAC<->UE MAC (NFAPI Transport)
|
||||
- RRC Extensions for “on-network” cases
|
||||
|
||||
NFAPI configuration (required even for Scenario 1 target)
|
||||
- git clone https://github.com/cisco/open-nFAPI.git
|
||||
- cd open-nfapi
|
||||
- patch -p1 --dry-run < $OPENAIR_HOME/open-nfapi.oai.patch
|
||||
Validate that there are no errors
|
||||
- patch -p1 < $OPENAIR_HOME/open-nfapi.oai.patch
|
||||
|
||||
OAI build/execute
|
||||
- export NFAPI_DIR=XXX (place where NFAPI was installed)
|
||||
- cd cmake_targets
|
||||
- ./build_oai --UE
|
||||
(if necessary, use ./build_oai -I --UE to install required packages)
|
||||
- cd lte_build_oai/build/
|
||||
- cp ../../../targets/bin/.ue* .
|
||||
- cp ../../../targets/bin/.usim* .
|
||||
- sudo insmod ../../../targets/bin/ue_ip.ko
|
||||
|
||||
UE1:
|
||||
- sudo ifconfig oip0 10.0.0.1
|
||||
- sudo iptables -A POSTROUTING -t mangle -o oip0 -d 224.0.0.3 -j MARK --set-mark 3
|
||||
- (if necessary) sudo route add default gw 10.10.10.1 eth0
|
||||
UE2:
|
||||
- sudo ifconfig oip0 10.0.0.2
|
||||
- sudo iptables -A POSTROUTING -t mangle -o oip0 -d 224.0.0.3 -j MARK --set-mark 3
|
||||
- (if necessary) sudo route add default gw 10.10.10.1 eno1
|
||||
|
||||
UE1 and UE2: Get and build vencore_app from d2d-l3-stub (branch: l3_stub)
|
||||
- gcc -I . vencore_app.c -o vencore_app -lpthread
|
||||
|
||||
--------------------------------
|
||||
TEST ONE-TO-MANY
|
||||
Run UE1 then UE2, for example:
|
||||
UE1: sudo ./lte-softmodem-stub -U --emul-iface eth0
|
||||
UE2: sudo ./lte-softmodem-stub -U --emul-iface eno1
|
||||
|
||||
Test with Ping
|
||||
- Sender - UE1: ping -I oip0 224.0.0.3
|
||||
- Receiver - UE2: using wireshark
|
||||
|
||||
Test with Iperf
|
||||
- Sender - UE1: iperf -c 224.0.0.3 -u -b 0.1M --bind 10.0.0.1 -t 100
|
||||
- Receiver - UE2: sudo ./mcreceive 224.0.0.3 5001
|
||||
|
||||
Filter the incomming packets according to GroupL2Id: receiver (one-to-many) can discard the packets if it doesn't belong to this group.
|
||||
For the moment, both sender and receiver use the same set of Ids (hardcoded)
|
||||
|
||||
UE1 (sender)
|
||||
- sudo ./lte-softmodem-stub -U --emul-iface eth0
|
||||
- ./vencore_app #send the sourceL2Id, groupL2Id to OAI
|
||||
- ping -I oip0 224.0.0.3
|
||||
UE2(receiver)
|
||||
- sudo ./lte-softmodem-stub -U --emul-iface eno1
|
||||
#we can see the incomming packets from OAI log, however, cannot see from Wireshark -> they are discarded at MAC layer
|
||||
- ./vencore_app #we can see the packets appearing in Wireshark
|
||||
|
||||
--------------------------------------
|
||||
TEST PC5-S (UE1 -sender, UE2 - receiver) and PC5-U for ONE-TO-ONE scenario
|
||||
Configure UE1/UE2
|
||||
UE1:
|
||||
- sudo ifconfig oip0 10.0.0.1
|
||||
- sudo iptables -A POSTROUTING -t mangle -o oip0 -d 10.0.0.2 -j MARK --set-mark 3
|
||||
- sudo route add default gw 10.10.10.1 eth0
|
||||
UE2:
|
||||
- sudo ifconfig oip0 10.0.0.2
|
||||
- sudo iptables -A POSTROUTING -t mangle -o oip0 -d 10.0.0.1 -j MARK --set-mark 3
|
||||
- sudo route add default gw 10.10.10.1 eno1
|
||||
|
||||
step 1:
|
||||
- UE1: sudo ./lte-softmodem-stub -U --emul-iface eth0
|
||||
step 2:
|
||||
- UE2: sudo ./lte-softmodem-stub -U --emul-iface eno1
|
||||
- UE2: ./vencore_app -r #listen to incomming message from PC5-S
|
||||
step 3:
|
||||
- UE1: ./vencore_app -s #send a message via PC5-S (e.g., DirectCommunicationRequest)
|
||||
|
||||
Generate unicast traffic
|
||||
UE1: ping -I oip0 10.0.0.2
|
||||
|
||||
|
||||
--------------------------------------
|
||||
TEST PC5-D
|
||||
step 1:
|
||||
- UE1: sudo ./lte-softmodem-stub -U --emul-iface eth0
|
||||
- UE1: ./vencore_app -d #send a PC5-Discovery-Announcement via PC5D
|
||||
step 2:
|
||||
- UE2: sudo ./lte-softmodem-stub -U --emul-iface eno1
|
||||
- UE2: ./vencore_app -d #send a PC5-Discovery-Announcement via PC5D
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "nfapi.h"
|
||||
#include "nfapi_pnf.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "openair2/PHY_INTERFACE/phy_stub_UE.h"
|
||||
//#include "openair1/PHY/vars.h"
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
@@ -47,7 +48,10 @@ extern RAN_CONTEXT_t RC;
|
||||
#include "fapi_stub.h"
|
||||
//#include "fapi_l1.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "openair2/LAYER2/MAC/proto.h"
|
||||
#include "openair2/LAYER2/MAC/mac_proto.h"
|
||||
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
|
||||
#define NUM_P5_PHY 2
|
||||
|
||||
@@ -61,8 +65,10 @@ extern pthread_mutex_t nfapi_sync_mutex;
|
||||
extern int nfapi_sync_var;
|
||||
|
||||
extern int sync_var;
|
||||
char uecap_xer_in;
|
||||
|
||||
extern void init_eNB_afterRU(void);
|
||||
extern void init_UE_stub(int nb_inst,int,int);
|
||||
extern void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB, int frame, int subframe, eNB_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu);
|
||||
extern void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, nfapi_ul_config_request_pdu_t *ul_config_pdu, uint16_t frame,uint8_t subframe,uint8_t srs_present);
|
||||
extern void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame, int subframe, eNB_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu, uint8_t codeword_index, uint8_t *sdu);
|
||||
@@ -508,9 +514,31 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
|
||||
|
||||
pnf_info* pnf = (pnf_info*)(config->user_data);
|
||||
uint8_t num_tlv = 0;
|
||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
|
||||
//struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
|
||||
// Panos: In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim
|
||||
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
|
||||
LTE_DL_FRAME_PARMS *fp;
|
||||
if (nfapi_mode!=3) {
|
||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
fp = &eNB->frame_parms;
|
||||
}
|
||||
else{
|
||||
fp = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
//DJP
|
||||
auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
|
||||
{ return item.id == req->header.phy_id; });
|
||||
|
||||
if(found != pnf->phys.end())
|
||||
{
|
||||
phy_info& phy_info = (*found);
|
||||
}
|
||||
#endif
|
||||
//DJP
|
||||
phy_info* phy_info = pnf->phys;
|
||||
|
||||
if(req->nfapi_config.timing_window.tl.tag == NFAPI_NFAPI_TIMING_WINDOW_TAG) {
|
||||
@@ -667,6 +695,7 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
|
||||
num_tlv++;
|
||||
}
|
||||
|
||||
if(nfapi_mode!=3) {
|
||||
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
|
||||
|
||||
printf("[PNF] Simulating PHY CONFIG - DJP\n");
|
||||
@@ -678,6 +707,7 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
|
||||
phy_config_request(&phy_config);
|
||||
|
||||
dump_frame_parms(fp);
|
||||
}
|
||||
|
||||
phy_info->remote_port = req->nfapi_config.p7_vnf_port.value;
|
||||
|
||||
@@ -695,6 +725,8 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
|
||||
nfapi_resp.error_code = 0; // DJP - some value resp->error_code;
|
||||
nfapi_pnf_config_resp(config, &nfapi_resp);
|
||||
printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
|
||||
if(nfapi_mode ==3)
|
||||
free(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1081,6 +1113,7 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
|
||||
}
|
||||
|
||||
if(phy_info->timing_info_mode & 0x2) {
|
||||
//printf("Panos-D: start_request () Enabling timing_info_mode_aperiodic \n");
|
||||
p7_config->timing_info_mode_aperiodic = 1;
|
||||
}
|
||||
|
||||
@@ -1090,77 +1123,110 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
|
||||
p7_config->tx_req = &pnf_phy_tx_req;
|
||||
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
|
||||
|
||||
memset(&dummy_dl_config_req, 0, sizeof(dummy_dl_config_req));
|
||||
dummy_dl_config_req.dl_config_request_body.tl.tag=NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdcch_ofdm_symbols=1;
|
||||
dummy_dl_config_req.dl_config_request_body.number_dci=0;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdu=0;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdsch_rnti=0;
|
||||
dummy_dl_config_req.dl_config_request_body.transmission_power_pcfich=6000;
|
||||
dummy_dl_config_req.dl_config_request_body.dl_config_pdu_list=0;
|
||||
if (nfapi_mode==3) {
|
||||
p7_config->dl_config_req = &memcpy_dl_config_req;
|
||||
p7_config->ul_config_req = &memcpy_ul_config_req;
|
||||
p7_config->hi_dci0_req = &memcpy_hi_dci0_req;
|
||||
p7_config->tx_req = &memcpy_tx_req;
|
||||
}
|
||||
else {
|
||||
p7_config->dl_config_req = &pnf_phy_dl_config_req;
|
||||
p7_config->ul_config_req = &pnf_phy_ul_config_req;
|
||||
p7_config->hi_dci0_req = &pnf_phy_hi_dci0_req;
|
||||
p7_config->tx_req = &pnf_phy_tx_req;
|
||||
}
|
||||
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
|
||||
|
||||
memset(&dummy_tx_req, 0, sizeof(dummy_tx_req));
|
||||
dummy_tx_req.tx_request_body.number_of_pdus=0;
|
||||
dummy_tx_req.tx_request_body.tl.tag=NFAPI_TX_REQUEST_BODY_TAG;
|
||||
memset(&dummy_dl_config_req, 0, sizeof(dummy_dl_config_req));
|
||||
dummy_dl_config_req.dl_config_request_body.tl.tag=NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdcch_ofdm_symbols=1;
|
||||
dummy_dl_config_req.dl_config_request_body.number_dci=0;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdu=0;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdsch_rnti=0;
|
||||
dummy_dl_config_req.dl_config_request_body.transmission_power_pcfich=6000;
|
||||
dummy_dl_config_req.dl_config_request_body.dl_config_pdu_list=0;
|
||||
|
||||
dummy_subframe.dl_config_req = &dummy_dl_config_req;
|
||||
dummy_subframe.tx_req = 0;//&dummy_tx_req;
|
||||
memset(&dummy_tx_req, 0, sizeof(dummy_tx_req));
|
||||
dummy_tx_req.tx_request_body.number_of_pdus=0;
|
||||
dummy_tx_req.tx_request_body.tl.tag=NFAPI_TX_REQUEST_BODY_TAG;
|
||||
|
||||
dummy_subframe.ul_config_req=0;
|
||||
dummy_subframe.hi_dci0_req=0;
|
||||
dummy_subframe.lbt_dl_config_req=0;
|
||||
dummy_subframe.dl_config_req = &dummy_dl_config_req;
|
||||
dummy_subframe.tx_req = 0;//&dummy_tx_req;
|
||||
|
||||
p7_config->dummy_subframe = dummy_subframe;
|
||||
dummy_subframe.ul_config_req=0;
|
||||
dummy_subframe.hi_dci0_req=0;
|
||||
dummy_subframe.lbt_dl_config_req=0;
|
||||
|
||||
p7_config->vendor_ext = &pnf_phy_vendor_ext;
|
||||
p7_config->dummy_subframe = dummy_subframe;
|
||||
|
||||
p7_config->allocate_p7_vendor_ext = &pnf_phy_allocate_p7_vendor_ext;
|
||||
p7_config->deallocate_p7_vendor_ext = &pnf_phy_deallocate_p7_vendor_ext;
|
||||
p7_config->vendor_ext = &pnf_phy_vendor_ext;
|
||||
|
||||
p7_config->codec_config.unpack_p7_vendor_extension = &pnf_phy_unpack_p7_vendor_extension;
|
||||
p7_config->codec_config.pack_p7_vendor_extension = &pnf_phy_pack_p7_vendor_extension;
|
||||
p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_phy_unpack_vendor_extension_tlv;
|
||||
p7_config->codec_config.pack_vendor_extension_tlv = &pnf_phy_pack_vendor_extention_tlv;
|
||||
p7_config->allocate_p7_vendor_ext = &pnf_phy_allocate_p7_vendor_ext;
|
||||
p7_config->deallocate_p7_vendor_ext = &pnf_phy_deallocate_p7_vendor_ext;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
|
||||
pthread_t p7_thread;
|
||||
pthread_create(&p7_thread, NULL, &pnf_p7_thread_start, p7_config);
|
||||
p7_config->codec_config.unpack_p7_vendor_extension = &pnf_phy_unpack_p7_vendor_extension;
|
||||
p7_config->codec_config.pack_p7_vendor_extension = &pnf_phy_pack_p7_vendor_extension;
|
||||
p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_phy_unpack_vendor_extension_tlv;
|
||||
p7_config->codec_config.pack_vendor_extension_tlv = &pnf_phy_pack_vendor_extention_tlv;
|
||||
|
||||
//((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
|
||||
pthread_t p7_thread;
|
||||
pthread_create(&p7_thread, NULL, &pnf_p7_thread_start, p7_config);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
|
||||
l1_north_init_eNB();
|
||||
//((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
|
||||
p7_config_g = p7_config;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
|
||||
l1_north_init_eNB();
|
||||
|
||||
// Need to wait for main thread to create RU structures
|
||||
while(config_sync_var<0) {
|
||||
usleep(5000000);
|
||||
printf("[PNF] waiting for OAI to be configured (eNB/RU)\n");
|
||||
}
|
||||
printf("[PNF] OAI eNB/RU configured\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
|
||||
p7_config_g = p7_config;
|
||||
|
||||
printf("[PNF] About to call init_eNB_afterRU()\n");
|
||||
init_eNB_afterRU();
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Panos-D: start_request, BUFFER SIZE: %d", p7_config_g->subframe_buffer_size);
|
||||
//printf("Panos-D: start_request, bUFFER SIZE: %d", p7_config_g->subframe_buffer_size);
|
||||
|
||||
// Signal to main thread that it can carry on - otherwise RU will startup too quickly and it is not initialised
|
||||
pthread_mutex_lock(&nfapi_sync_mutex);
|
||||
nfapi_sync_var=0;
|
||||
pthread_cond_broadcast(&nfapi_sync_cond);
|
||||
pthread_mutex_unlock(&nfapi_sync_mutex);
|
||||
// Need to wait for main thread to create RU structures
|
||||
while(config_sync_var<0)
|
||||
{
|
||||
usleep(5000000);
|
||||
printf("[PNF] waiting for OAI to be configured (eNB/RU)\n");
|
||||
}
|
||||
printf("[PNF] OAI eNB/RU configured\n");
|
||||
|
||||
while(sync_var<0) {
|
||||
usleep(5000000);
|
||||
printf("[PNF] waiting for OAI to be started\n");
|
||||
}
|
||||
//printf("[PNF] About to call phy_init_RU() for RC.ru[0]:%p\n", RC.ru[0]);
|
||||
//phy_init_RU(RC.ru[0]);
|
||||
|
||||
printf("[PNF] Sending PNF_START_RESP\n");
|
||||
nfapi_send_pnf_start_resp(config, p7_config->phy_id);
|
||||
printf("[PNF] About to call init_eNB_afterRU()\n");
|
||||
|
||||
printf("[PNF] Sending first P7 subframe ind\n");
|
||||
nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct???
|
||||
printf("[PNF] Sent first P7 subframe ind\n");
|
||||
// Panos: Instead
|
||||
/*if (nfapi_mode == 3) {
|
||||
init_UE_stub(1,0,uecap_xer_in);
|
||||
}*/
|
||||
//else{
|
||||
if (nfapi_mode != 3) {
|
||||
// Panos
|
||||
init_eNB_afterRU();
|
||||
}
|
||||
|
||||
// Signal to main thread that it can carry on - otherwise RU will startup too quickly and it is not initialised
|
||||
{
|
||||
pthread_mutex_lock(&nfapi_sync_mutex);
|
||||
nfapi_sync_var=0;
|
||||
pthread_cond_broadcast(&nfapi_sync_cond);
|
||||
pthread_mutex_unlock(&nfapi_sync_mutex);
|
||||
}
|
||||
|
||||
while(sync_var<0)
|
||||
{
|
||||
usleep(5000000);
|
||||
printf("[PNF] waiting for OAI to be started\n");
|
||||
}
|
||||
|
||||
printf("[PNF] Sending PNF_START_RESP\n");
|
||||
nfapi_send_pnf_start_resp(config, p7_config->phy_id);
|
||||
|
||||
printf("[PNF] Sending first P7 subframe ind\n");
|
||||
nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct???
|
||||
printf("[PNF] Sent first P7 subframe ind\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1464,7 +1530,9 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
|
||||
|
||||
printf("%s() PNF\n\n\n\n\n\n", __FUNCTION__);
|
||||
|
||||
if(nfapi_mode!=3) {
|
||||
nfapi_mode = 1; // PNF!
|
||||
}
|
||||
|
||||
nfapi_pnf_config_t* config = nfapi_pnf_config_create();
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
#include "vendor_ext.h"
|
||||
|
||||
#include "nfapi_vnf.h"
|
||||
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
@@ -1247,9 +1247,14 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
|
||||
if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
|
||||
|
||||
// Panos: Careful here!!!
|
||||
//if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
|
||||
if (vnf_pnf_sfnsf_delta>0 || vnf_pnf_sfnsf_delta < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf));
|
||||
// Panos: Careful here!!!
|
||||
vnf_p7->p7_connections[0].sfn_sf = ind.last_sfn_sf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
|
||||
//#define DEBUG_TURBO_ENCODER 1
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
date: 09.2012
|
||||
*/
|
||||
#ifndef TC_MAIN
|
||||
#include "defs.h"
|
||||
#include "coding_defs.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
#include "vars.h"
|
||||
#include "coding_vars.h"
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
|
||||
|
||||
@@ -42,8 +42,9 @@
|
||||
|
||||
|
||||
#ifndef TEST_DEBUG
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
@@ -41,8 +41,9 @@
|
||||
#include "PHY/sse_intrin.h"
|
||||
|
||||
#ifndef TEST_DEBUG
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
#include "PHY/sse_intrin.h"
|
||||
|
||||
#ifndef TEST_DEBUG
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
author: raymond.knopp@eurecom.fr, based on similar code for 3GPP convolutional code (UMTS) by P. Humblet (2000)
|
||||
date: 10.2004
|
||||
*/
|
||||
#include "defs.h"
|
||||
#include "coding_defs.h"
|
||||
|
||||
|
||||
unsigned short gdot11[] = { 0133, 0171 }; // {A,B}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
author: raymond.knopp@eurecom.fr
|
||||
date: 21.10.2009
|
||||
*/
|
||||
#include "defs.h"
|
||||
#include "coding_defs.h"
|
||||
|
||||
//#define DEBUG_CCODE 1
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_common.h"
|
||||
|
||||
#define CRC24_A 0
|
||||
#define CRC24_B 1
|
||||
@@ -75,20 +75,7 @@ int32_t lte_segmentation(uint8_t *input_buffer,
|
||||
uint32_t *Kminus,
|
||||
uint32_t *F);
|
||||
|
||||
/** \fn int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs)
|
||||
\brief this functions calculates the delta MCS in dB based on the lte_segmentation function
|
||||
\param tbs transport block size
|
||||
\param nb_rb number of required rb
|
||||
\param control_only a flag for the type of data
|
||||
\param ncp cyclic prefix
|
||||
\param use_srs a flag indicating the use of srs in the current SF
|
||||
\returns ue_tx_power estimated ue tx power = delat_ mcs + bw_factor
|
||||
*/
|
||||
int16_t estimate_ue_tx_power(uint32_t tbs,
|
||||
uint32_t nb_rb,
|
||||
uint8_t control_only,
|
||||
lte_prefix_type_t ncp,
|
||||
uint8_t use_srs);
|
||||
|
||||
|
||||
/** \fn uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w)
|
||||
\brief This is the subblock interleaving algorithm from 36-212 (Release 8, 8.6 2009-03), pages 15-16.
|
||||
@@ -33,8 +33,8 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/utils/telnetsrv/telnetsrv.h"
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "defs.h"
|
||||
#include "coding_defs.h"
|
||||
|
||||
|
||||
/*ref 36-212 v8.6.0 , pp 8-9 */
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include "PHY/defs.h"
|
||||
#include "assertions.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_common.h"
|
||||
|
||||
//#define cmin(a,b) ((a)<(b) ? (a) : (b))
|
||||
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
author: raymond.knopp@eurecom.fr
|
||||
date: 21.10.2009
|
||||
*/
|
||||
#include "PHY/defs.h"
|
||||
#include "SCHED/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
|
||||
//#define DEBUG_SEGMENTATION
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
#ifndef TEST_DEBUG
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
//#include "TDD-Config.h"
|
||||
//#include "MBSFN-SubframeConfigList.h"
|
||||
//#include "MobilityControlInfo.h"
|
||||
//#if defined(Rel10) || defined(Rel14)
|
||||
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
//#include "SCellToAddMod-r10.h"
|
||||
//#endif
|
||||
|
||||
|
||||
@@ -20,9 +20,50 @@
|
||||
*/
|
||||
|
||||
/*!\brief Initilization and reconfiguration routines for LTE PHY */
|
||||
#include "defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/CODING/extern.h"
|
||||
#include "phy_init.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
|
||||
void generate_64qam_table(void)
|
||||
{
|
||||
|
||||
int a,b,c,index;
|
||||
|
||||
|
||||
for (a=-1; a<=1; a+=2)
|
||||
for (b=-1; b<=1; b+=2)
|
||||
for (c=-1; c<=1; c+=2) {
|
||||
index = (1+a)*2 + (1+b) + (1+c)/2;
|
||||
qam64_table[index] = -a*(QAM64_n1 + b*(QAM64_n2 + (c*QAM64_n3))); // 0 1 2
|
||||
}
|
||||
}
|
||||
|
||||
void generate_16qam_table(void)
|
||||
{
|
||||
|
||||
int a,b,index;
|
||||
|
||||
for (a=-1; a<=1; a+=2)
|
||||
for (b=-1; b<=1; b+=2) {
|
||||
index = (1+a) + (1+b)/2;
|
||||
qam16_table[index] = -a*(QAM16_n1 + (b*QAM16_n2));
|
||||
}
|
||||
}
|
||||
|
||||
void generate_qpsk_table(void)
|
||||
{
|
||||
|
||||
int a,index;
|
||||
|
||||
for (a=-1; a<=1; a+=2) {
|
||||
index = (1+a)/2;
|
||||
qpsk_table[index] = -a*QPSK;
|
||||
}
|
||||
}
|
||||
|
||||
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
|
||||
@@ -19,14 +19,17 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "phy_init.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
@@ -179,7 +182,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
|
||||
fp->frame_type,
|
||||
RC.eNB[Mod_id][CC_id]->X_u);
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
fp->prach_emtc_config_common.prach_Config_enabled=1;
|
||||
|
||||
fp->prach_emtc_config_common.rootSequenceIndex = cfg->emtc_config.prach_catm_root_sequence_index.value;
|
||||
@@ -721,24 +724,6 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_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)
|
||||
{
|
||||
// uint8_t i;
|
||||
|
||||
if (eNB_flag == 0 ) {
|
||||
//LOG_D(PHY,"[UE %d] configure cba group %d with rnti %x, num active cba grp %d\n", index, index, cba_rnti, num_active_cba_groups);
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->ulsch[index]->num_active_cba_groups=num_active_cba_groups;
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->ulsch[index]->cba_rnti[cba_group_id]=cba_rnti;
|
||||
} else {
|
||||
//for (i=index; i < NUMBER_OF_UE_MAX; i+=num_active_cba_groups){
|
||||
// LOG_D(PHY,"[eNB %d] configure cba group %d with rnti %x for UE %d, num active cba grp %d\n",Mod_id, i%num_active_cba_groups, cba_rnti, i, num_active_cba_groups);
|
||||
RC.eNB[Mod_id][CC_id]->ulsch[index]->num_active_cba_groups=num_active_cba_groups;
|
||||
RC.eNB[Mod_id][CC_id]->ulsch[index]->cba_rnti[cba_group_id] = cba_rnti;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
|
||||
unsigned char is_secondary_eNB,
|
||||
unsigned char abstraction_flag)
|
||||
@@ -750,7 +735,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
|
||||
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
|
||||
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
|
||||
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
|
||||
#endif
|
||||
int i, UE_id;
|
||||
@@ -846,7 +831,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
|
||||
|
||||
prach_vars->rxsigF[0] = (int16_t**)malloc16_clear(64*sizeof(int16_t*));
|
||||
// PRACH BR
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
prach_vars_br->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int32_t) );
|
||||
|
||||
// assume maximum of 64 RX antennas for PRACH receiver
|
||||
@@ -914,7 +899,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
|
||||
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
|
||||
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
|
||||
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
|
||||
#endif
|
||||
int i, UE_id;
|
||||
@@ -947,7 +932,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
|
||||
for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
|
||||
free_and_zero(prach_vars->prach_ifft[0]);
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (int ce_level = 0; ce_level < 4; ce_level++) {
|
||||
for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]);
|
||||
free_and_zero(prach_vars_br->prach_ifft[ce_level]);
|
||||
|
||||
@@ -19,14 +19,13 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
#include "phy_init.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
@@ -99,7 +98,7 @@ int phy_init_RU(RU_t *ru) {
|
||||
for (i=0; i<ru->nb_rx; i++) {
|
||||
ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
|
||||
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (j=0;j<4;j++) {
|
||||
ru->prach_rxsigF_br[j][i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
|
||||
LOG_D(PHY,"[INIT] prach_vars_br->rxsigF[%d] = %p\n",i,ru->prach_rxsigF_br[j][i]);
|
||||
@@ -177,7 +176,7 @@ void phy_free_RU(RU_t *ru)
|
||||
|
||||
for (i = 0; i < ru->nb_rx; i++) {
|
||||
free_and_zero(ru->prach_rxsigF[i]);
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -19,21 +19,23 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
#include "phy_init.h"
|
||||
#include "SCHED_UE/sched_UE.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
@@ -340,7 +342,7 @@ void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n
|
||||
|
||||
}
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
uint8_t eNB_index,
|
||||
SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
@@ -563,14 +565,17 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
phy_vars_ue->decode_SIB = 0;
|
||||
phy_vars_ue->decode_MIB = 0;
|
||||
}
|
||||
//phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
|
||||
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
|
||||
else
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
|
||||
LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
|
||||
if(nfapi_mode!=3){
|
||||
//phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
|
||||
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
|
||||
else
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
|
||||
LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -651,7 +656,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
int th_id;
|
||||
|
||||
LOG_D(PHY,"Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
|
||||
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -704,6 +709,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_tti*10+2048)*sizeof(int32_t) );
|
||||
LOG_I(PHY,"common_vars->rxdata[%d] %p\n",i,common_vars->rxdata[i]);
|
||||
common_vars->common_vars_rx_data_per_thread[0].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
common_vars->common_vars_rx_data_per_thread[1].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
}
|
||||
@@ -853,6 +859,9 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dciFormat = 0;
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->agregationLevel = 0xFF;
|
||||
}
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
|
||||
@@ -25,10 +25,14 @@
|
||||
#include <execinfo.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "phy_init.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
|
||||
extern PHY_VARS_eNB *eNB;
|
||||
extern PHY_VARS_UE *UE;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "phy_init.h"
|
||||
#include "log.h"
|
||||
|
||||
uint16_t dl_S_table_normal[10]={3,9,10,11,12,3,9,10,11,6};
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#ifndef __INIT_DEFS__H__
|
||||
#define __INIT_DEFS__H__
|
||||
|
||||
#include "PHY/defs.h"
|
||||
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
|
||||
#include "SystemInformationBlockType2.h"
|
||||
//#include "RadioResourceConfigCommonSIB.h"
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "PHICH-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "MobilityControlInfo.h"
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
#include "SCellToAddMod-r10.h"
|
||||
#endif
|
||||
/** @addtogroup _PHY_STRUCTURES_
|
||||
@@ -349,7 +349,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
uint32_t perfect_ce);
|
||||
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
uint8_t eNB_index,
|
||||
SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
|
||||
void
|
||||
phy_adjust_gain (PHY_VARS_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
|
||||
// This is 512/(1:256) in __m128i format
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
*/
|
||||
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "openair2/LAYER2/MAC/mac_proto.h"
|
||||
|
||||
#define DEBUG_PHY
|
||||
|
||||
@@ -84,6 +85,11 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
{
|
||||
diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3);
|
||||
|
||||
#if BASIC_SIMULATOR
|
||||
/* a hack without which the UE does not connect (to be fixed somehow) */
|
||||
diff = 0;
|
||||
#endif
|
||||
|
||||
if ( abs(diff) < SYNCH_HYST )
|
||||
ue->rx_offset = 0;
|
||||
else
|
||||
@@ -134,128 +140,3 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
LTE_eNB_SRS *lte_eNB_srs,
|
||||
unsigned int *eNB_id,
|
||||
unsigned char clear,
|
||||
unsigned char number_of_cards,
|
||||
short coef)
|
||||
|
||||
{
|
||||
|
||||
static int max_pos_fil2 = 0;
|
||||
int temp, i, aa, max_pos = 0,ind;
|
||||
int max_val=0;
|
||||
short Re,Im,ncoef;
|
||||
#ifdef DEBUG_PHY
|
||||
char fname[100],vname[100];
|
||||
#endif
|
||||
|
||||
ncoef = 32768 - coef;
|
||||
|
||||
for (ind=0; ind<number_of_cards; ind++) {
|
||||
|
||||
if (ind==0)
|
||||
max_val=0;
|
||||
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
// do ifft of channel estimate
|
||||
switch(frame_parms->N_RB_DL) {
|
||||
case 6:
|
||||
dft128((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0],
|
||||
(int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa],
|
||||
1);
|
||||
break;
|
||||
case 25:
|
||||
dft512((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0],
|
||||
(int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa],
|
||||
1);
|
||||
break;
|
||||
case 50:
|
||||
dft1024((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0],
|
||||
(int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa],
|
||||
1);
|
||||
break;
|
||||
case 100:
|
||||
dft2048((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0],
|
||||
(int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa],
|
||||
1);
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUG_PHY
|
||||
sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa);
|
||||
sprintf(vname,"srs_time_%d%d",ind,aa);
|
||||
write_output(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
// we only use channel estimates from tx antenna 0 here
|
||||
// remember we fixed the SRS to use only every second subcarriers
|
||||
for (i = 0; i < frame_parms->ofdm_symbol_size/2; i++) {
|
||||
temp = 0;
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
Re = ((int16_t*)lte_eNB_srs->srs_ch_estimates_time[aa])[(i<<1)];
|
||||
Im = ((int16_t*)lte_eNB_srs->srs_ch_estimates_time[aa])[1+(i<<1)];
|
||||
temp += (Re*Re/2) + (Im*Im/2);
|
||||
}
|
||||
|
||||
if (temp > max_val) {
|
||||
max_pos = i;
|
||||
max_val = temp;
|
||||
*eNB_id = ind;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// filter position to reduce jitter
|
||||
if (clear == 1)
|
||||
max_pos_fil2 = max_pos;
|
||||
else
|
||||
max_pos_fil2 = ((max_pos_fil2 * coef) + (max_pos * ncoef)) >> 15;
|
||||
|
||||
return(max_pos_fil2);
|
||||
}
|
||||
|
||||
|
||||
int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
|
||||
{
|
||||
int temp, i, aa, max_pos=0, max_val=0;
|
||||
short Re,Im;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id];
|
||||
int32_t **ul_ch_estimates_time= eNB_pusch_vars->drs_ch_estimates_time;
|
||||
uint8_t cyclic_shift = 0;
|
||||
int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
|
||||
|
||||
AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size);
|
||||
AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n",
|
||||
frame_parms->nb_antennas_rx);
|
||||
for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
|
||||
temp = 0;
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)];
|
||||
Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)];
|
||||
temp += (Re*Re/2) + (Im*Im/2);
|
||||
}
|
||||
|
||||
if (temp > max_val) {
|
||||
max_pos = i;
|
||||
max_val = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (max_pos>frame_parms->ofdm_symbol_size/2)
|
||||
max_pos = max_pos-frame_parms->ofdm_symbol_size;
|
||||
|
||||
//#ifdef DEBUG_PHY
|
||||
LOG_D(PHY,"frame %d: max_pos = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,sync_pos);
|
||||
//#endif //DEBUG_PHY
|
||||
|
||||
return max_pos - sync_pos;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#define DEBUG_PHY
|
||||
|
||||
int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
LTE_eNB_SRS *lte_eNB_srs,
|
||||
unsigned int *eNB_id,
|
||||
unsigned char clear,
|
||||
unsigned char number_of_cards,
|
||||
short coef)
|
||||
|
||||
{
|
||||
|
||||
static int max_pos_fil2 = 0;
|
||||
int temp, i, aa, max_pos = 0,ind;
|
||||
int max_val=0;
|
||||
short Re,Im,ncoef;
|
||||
#ifdef DEBUG_PHY
|
||||
char fname[100],vname[100];
|
||||
#endif
|
||||
|
||||
ncoef = 32768 - coef;
|
||||
|
||||
for (ind=0; ind<number_of_cards; ind++) {
|
||||
|
||||
if (ind==0)
|
||||
max_val=0;
|
||||
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
// do ifft of channel estimate
|
||||
switch(frame_parms->N_RB_DL) {
|
||||
case 6:
|
||||
dft128((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0],
|
||||
(int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa],
|
||||
1);
|
||||
break;
|
||||
case 25:
|
||||
dft512((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0],
|
||||
(int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa],
|
||||
1);
|
||||
break;
|
||||
case 50:
|
||||
dft1024((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0],
|
||||
(int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa],
|
||||
1);
|
||||
break;
|
||||
case 100:
|
||||
dft2048((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0],
|
||||
(int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa],
|
||||
1);
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUG_PHY
|
||||
sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa);
|
||||
sprintf(vname,"srs_time_%d%d",ind,aa);
|
||||
write_output(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
// we only use channel estimates from tx antenna 0 here
|
||||
// remember we fixed the SRS to use only every second subcarriers
|
||||
for (i = 0; i < frame_parms->ofdm_symbol_size/2; i++) {
|
||||
temp = 0;
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
Re = ((int16_t*)lte_eNB_srs->srs_ch_estimates_time[aa])[(i<<1)];
|
||||
Im = ((int16_t*)lte_eNB_srs->srs_ch_estimates_time[aa])[1+(i<<1)];
|
||||
temp += (Re*Re/2) + (Im*Im/2);
|
||||
}
|
||||
|
||||
if (temp > max_val) {
|
||||
max_pos = i;
|
||||
max_val = temp;
|
||||
*eNB_id = ind;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// filter position to reduce jitter
|
||||
if (clear == 1)
|
||||
max_pos_fil2 = max_pos;
|
||||
else
|
||||
max_pos_fil2 = ((max_pos_fil2 * coef) + (max_pos * ncoef)) >> 15;
|
||||
|
||||
return(max_pos_fil2);
|
||||
}
|
||||
|
||||
|
||||
int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
|
||||
{
|
||||
int temp, i, aa, max_pos=0, max_val=0;
|
||||
short Re,Im;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id];
|
||||
int32_t **ul_ch_estimates_time= eNB_pusch_vars->drs_ch_estimates_time;
|
||||
uint8_t cyclic_shift = 0;
|
||||
int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
|
||||
|
||||
AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size);
|
||||
AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n",
|
||||
frame_parms->nb_antennas_rx);
|
||||
for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
|
||||
temp = 0;
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)];
|
||||
Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)];
|
||||
temp += (Re*Re/2) + (Im*Im/2);
|
||||
}
|
||||
|
||||
if (temp > max_val) {
|
||||
max_pos = i;
|
||||
max_val = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (max_pos>frame_parms->ofdm_symbol_size/2)
|
||||
max_pos = max_pos-frame_parms->ofdm_symbol_size;
|
||||
|
||||
//#ifdef DEBUG_PHY
|
||||
LOG_D(PHY,"frame %d: max_pos = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,sync_pos);
|
||||
//#endif //DEBUG_PHY
|
||||
|
||||
return max_pos - sync_pos;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "openair2/LAYER2/MAC/mac_proto.h"
|
||||
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#define DEBUG_PHY
|
||||
|
||||
// Adjust location synchronization point to account for drift
|
||||
// The adjustment is performed once per frame based on the
|
||||
// last channel estimate of the receiver
|
||||
|
||||
void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
PHY_VARS_UE *ue,
|
||||
unsigned char eNB_id,
|
||||
uint8_t subframe,
|
||||
unsigned char clear,
|
||||
short coef)
|
||||
{
|
||||
|
||||
static int max_pos_fil = 0;
|
||||
static int count_max_pos_ok = 0;
|
||||
static int first_time = 1;
|
||||
int temp = 0, i, aa, max_val = 0, max_pos = 0;
|
||||
int diff;
|
||||
short Re,Im,ncoef;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_IN);
|
||||
|
||||
ncoef = 32767 - coef;
|
||||
|
||||
#ifdef DEBUG_PHY
|
||||
LOG_D(PHY,"AbsSubframe %d.%d: rx_offset (before) = %d\n",ue->proc.proc_rxtx[0].frame_rx%1024,subframe,ue->rx_offset);
|
||||
#endif //DEBUG_PHY
|
||||
|
||||
|
||||
// we only use channel estimates from tx antenna 0 here
|
||||
for (i = 0; i < frame_parms->nb_prefix_samples; i++) {
|
||||
temp = 0;
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
Re = ((int16_t*)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id][aa])[(i<<2)];
|
||||
Im = ((int16_t*)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id][aa])[1+(i<<2)];
|
||||
temp += (Re*Re/2) + (Im*Im/2);
|
||||
}
|
||||
|
||||
if (temp > max_val) {
|
||||
max_pos = i;
|
||||
max_val = temp;
|
||||
}
|
||||
}
|
||||
|
||||
// filter position to reduce jitter
|
||||
if (clear == 1)
|
||||
max_pos_fil = max_pos;
|
||||
else
|
||||
max_pos_fil = ((max_pos_fil * coef) + (max_pos * ncoef)) >> 15;
|
||||
|
||||
// do not filter to have proactive timing adjustment
|
||||
max_pos_fil = max_pos;
|
||||
|
||||
if(subframe == 6)
|
||||
{
|
||||
diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3);
|
||||
|
||||
if ( abs(diff) < SYNCH_HYST )
|
||||
ue->rx_offset = 0;
|
||||
else
|
||||
ue->rx_offset = diff;
|
||||
|
||||
if(abs(diff)<5)
|
||||
count_max_pos_ok ++;
|
||||
else
|
||||
count_max_pos_ok = 0;
|
||||
|
||||
if(count_max_pos_ok > 10 && first_time == 1)
|
||||
{
|
||||
first_time = 0;
|
||||
ue->time_sync_cell = 1;
|
||||
if (ue->mac_enabled==1) {
|
||||
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
|
||||
//mac_resynch();
|
||||
dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
|
||||
ue->UE_mode[0] = PRACH;
|
||||
}
|
||||
else {
|
||||
ue->UE_mode[0] = PUSCH;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ue->rx_offset < 0 )
|
||||
ue->rx_offset += FRAME_LENGTH_COMPLEX_SAMPLES;
|
||||
|
||||
if ( ue->rx_offset >= FRAME_LENGTH_COMPLEX_SAMPLES )
|
||||
ue->rx_offset -= FRAME_LENGTH_COMPLEX_SAMPLES;
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_PHY
|
||||
LOG_D(PHY,"AbsSubframe %d.%d: ThreadId %d diff =%i rx_offset (final) = %i : clear %d,max_pos = %d,max_pos_fil = %d (peak %d) max_val %d target_pos %d \n",
|
||||
ue->proc.proc_rxtx[ue->current_thread_id[subframe]].frame_rx,
|
||||
subframe,
|
||||
ue->current_thread_id[subframe],
|
||||
diff,
|
||||
ue->rx_offset,
|
||||
clear,
|
||||
max_pos,
|
||||
max_pos_fil,
|
||||
temp,max_val,
|
||||
(frame_parms->nb_prefix_samples>>3));
|
||||
#endif //DEBUG_PHY
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_OUT);
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,10 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "lte_estimation.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
#include "filt16_32.h"
|
||||
//#define DEBUG_BF_CH
|
||||
|
||||
|
||||
@@ -20,12 +20,13 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "defs.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "filt96_32.h"
|
||||
#include "T.h"
|
||||
//#define DEBUG_CH
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "SCHED_UE/sched_UE.h"
|
||||
|
||||
int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
||||
uint8_t eNB_id,
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "lte_estimation.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
//#define DEBUG_CH
|
||||
int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *ue,
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
|
||||
#include "PHY/sse_intrin.h"
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
date: 19.11.2009
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
//#define DEBUG_PHY
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#ifndef __LTE_ESTIMATION_DEFS__H__
|
||||
#define __LTE_ESTIMATION_DEFS__H__
|
||||
|
||||
#include "PHY/defs.h"
|
||||
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
/** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_
|
||||
* @{
|
||||
*/
|
||||
@@ -26,19 +26,15 @@
|
||||
*/
|
||||
|
||||
//#include <string.h>
|
||||
#include "defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "SCHED/extern.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef OPENAIR2
|
||||
#include "LAYER2/MAC/defs.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "RRC/LITE/extern.h"
|
||||
#include "PHY_INTERFACE/extern.h"
|
||||
#endif
|
||||
//#define DEBUG_PHY
|
||||
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "RRC/LTE/rrc_extern.h"
|
||||
#include "PHY_INTERFACE/phy_interface.h"
|
||||
|
||||
|
||||
int* sync_corr_ue0 = NULL;
|
||||
int* sync_corr_ue1 = NULL;
|
||||
@@ -480,6 +476,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars
|
||||
{
|
||||
|
||||
@@ -629,6 +626,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
|
||||
|
||||
}
|
||||
|
||||
|
||||
int ru_sync_time(RU_t *ru,
|
||||
int64_t *lev,
|
||||
int64_t *avg)
|
||||
@@ -688,3 +686,4 @@ int ru_sync_time(RU_t *ru,
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
*/
|
||||
|
||||
//#include "defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#include "pss6144.h"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,13 +19,14 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
//#define DEBUG_CH
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
#include "T.h"
|
||||
#include "lte_estimation.h"
|
||||
|
||||
// round(exp(sqrt(-1)*(pi/2)*[0:1:N-1]/N)*pow2(15))
|
||||
static int16_t ru_90[2*128] = {32767, 0,32766, 402,32758, 804,32746, 1206,32729, 1608,32706, 2009,32679, 2411,32647, 2811,32610, 3212,32568, 3612,32522, 4011,32470, 4410,32413, 4808,32352, 5205,32286, 5602,32214, 5998,32138, 6393,32058, 6787,31972, 7180,31881, 7571,31786, 7962,31686, 8351,31581, 8740,31471, 9127,31357, 9512,31238, 9896,31114, 10279,30986, 10660,30853, 11039,30715, 11417,30572, 11793,30425, 12167,30274, 12540,30118, 12910,29957, 13279,29792, 13646,29622, 14010,29448, 14373,29269, 14733,29086, 15091,28899, 15447,28707, 15800,28511, 16151,28311, 16500,28106, 16846,27897, 17190,27684, 17531,27467, 17869,27246, 18205,27020, 18538,26791, 18868,26557, 19195,26320, 19520,26078, 19841,25833, 20160,25583, 20475,25330, 20788,25073, 21097,24812, 21403,24548, 21706,24279, 22006,24008, 22302,23732, 22595,23453, 22884,23170, 23170,22884, 23453,22595, 23732,22302, 24008,22006, 24279,21706, 24548,21403, 24812,21097, 25073,20788, 25330,20475, 25583,20160, 25833,19841, 26078,19520, 26320,19195, 26557,18868, 26791,18538, 27020,18205, 27246,17869, 27467,17531, 27684,17190, 27897,16846, 28106,16500, 28311,16151, 28511,15800, 28707,15447, 28899,15091, 29086,14733, 29269,14373, 29448,14010, 29622,13646, 29792,13279, 29957,12910, 30118,12540, 30274,12167, 30425,11793, 30572,11417, 30715,11039, 30853,10660, 30986,10279, 31114,9896, 31238,9512, 31357,9127, 31471,8740, 31581,8351, 31686,7962, 31786,7571, 31881,7180, 31972,6787, 32058,6393, 32138,5998, 32214,5602, 32286,5205, 32352,4808, 32413,4410, 32470,4011, 32522,3612, 32568,3212, 32610,2811, 32647,2411, 32679,2009, 32706,1608, 32729,1206, 32746,804, 32758,402, 32766};
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
|
||||
//extern unsigned int lte_gold_table[3][20][2][14];
|
||||
//#define DEBUG_DL_CELL_SPEC
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "lte_refsig.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
|
||||
//extern unsigned int lte_gold_table[10][3][42];
|
||||
//#define DEBUG_DL_MBSFN
|
||||
|
||||
@@ -33,9 +33,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "lte_refsig.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "log.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
|
||||
//extern unsigned int lte_gold_table[3][20][2][14];
|
||||
//#define DEBUG_DL_CELL_SPEC
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "lte_refsig.h"
|
||||
|
||||
|
||||
/* c(n) = x1(n+Nc) + x2(n+Nc) mod 2
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
//unsigned int lte_gold_table[10][3][42]; // need 165 bytes for sequence
|
||||
//slot index x pilot within slot x sequence*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "lte_refsig.h"
|
||||
|
||||
void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_table[10][3][42],uint16_t Nid_mbsfn)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
/* Author R. Knopp / EURECOM / OpenAirInterface.org */
|
||||
#ifndef __LTE_REFSIG_DEFS__H__
|
||||
#define __LTE_REFSIG_DEFS__H__
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
|
||||
/** @ingroup _PHY_REF_SIG
|
||||
* @{
|
||||
@@ -24,7 +24,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#endif
|
||||
#include "defs.h"
|
||||
#include "lte_refsig.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
|
||||
uint16_t dftsizes[33] = {12,24,36,48,60,72,96,108,120,144,180,192,216,240,288,300,324,360,384,432,480,540,576,600,648,720,864,900,960,972,1080,1152,1200};
|
||||
|
||||
|
||||
+24
-3650
File diff suppressed because it is too large
Load Diff
@@ -30,8 +30,18 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef __DCI__h__
|
||||
#define __DCI__h__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define CCEBITS 72
|
||||
#define CCEPERSYMBOL 33 // This is for 1200 RE
|
||||
#define CCEPERSYMBOL0 22 // This is for 1200 RE
|
||||
#define DCI_BITS_MAX ((2*CCEPERSYMBOL+CCEPERSYMBOL0)*CCEBITS)
|
||||
|
||||
//#define Mquad (Msymb/4)
|
||||
|
||||
/// DCI Format Type 0 (5 MHz,TDD0, 27 bits)
|
||||
struct DCI0_5MHz_TDD0 {
|
||||
/// type = 0 => DCI Format 0, type = 1 => DCI Format 1A
|
||||
@@ -3014,3 +3024,5 @@ struct DCI_INFO_EXTRACTED {
|
||||
uint64_t ap_si_nl_id:3;
|
||||
};
|
||||
typedef struct DCI_INFO_EXTRACTED DCI_INFO_EXTRACTED_t;
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file PHY/LTE_TRANSPORT/dci_tools_common_extern.h
|
||||
* \brief PHY Support routines (eNB/UE) for filling PDSCH/PUSCH/DLSCH/ULSCH data structures based on DCI PDUs generated by eNB MAC scheduler.
|
||||
* \author R. Knopp
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint32_t localRIV2alloc_LUT6[32];
|
||||
extern uint32_t distRIV2alloc_even_LUT6[32];
|
||||
extern uint32_t distRIV2alloc_odd_LUT6[32];
|
||||
extern uint16_t RIV2nb_rb_LUT6[32];
|
||||
extern uint16_t RIV2first_rb_LUT6[32];
|
||||
extern uint16_t RIV_max6;
|
||||
|
||||
extern uint32_t localRIV2alloc_LUT25[512];
|
||||
extern uint32_t distRIV2alloc_even_LUT25[512];
|
||||
extern uint32_t distRIV2alloc_odd_LUT25[512];
|
||||
extern uint16_t RIV2nb_rb_LUT25[512];
|
||||
extern uint16_t RIV2first_rb_LUT25[512];
|
||||
extern uint16_t RIV_max25;
|
||||
|
||||
|
||||
extern uint32_t localRIV2alloc_LUT50_0[1600];
|
||||
extern uint32_t localRIV2alloc_LUT50_1[1600];
|
||||
extern uint32_t distRIV2alloc_gap0_even_LUT50_0[1600];
|
||||
extern uint32_t distRIV2alloc_gap0_odd_LUT50_0[1600];
|
||||
extern uint32_t distRIV2alloc_gap0_even_LUT50_1[1600];
|
||||
extern uint32_t distRIV2alloc_gap0_odd_LUT50_1[1600];
|
||||
extern uint32_t distRIV2alloc_gap1_even_LUT50_0[1600];
|
||||
extern uint32_t distRIV2alloc_gap1_odd_LUT50_0[1600];
|
||||
extern uint32_t distRIV2alloc_gap1_even_LUT50_1[1600];
|
||||
extern uint32_t distRIV2alloc_gap1_odd_LUT50_1[1600];
|
||||
extern uint16_t RIV2nb_rb_LUT50[1600];
|
||||
extern uint16_t RIV2first_rb_LUT50[1600];
|
||||
extern uint16_t RIV_max50;
|
||||
|
||||
extern uint32_t localRIV2alloc_LUT100_0[6000];
|
||||
extern uint32_t localRIV2alloc_LUT100_1[6000];
|
||||
extern uint32_t localRIV2alloc_LUT100_2[6000];
|
||||
extern uint32_t localRIV2alloc_LUT100_3[6000];
|
||||
extern uint32_t distRIV2alloc_gap0_even_LUT100_0[6000];
|
||||
extern uint32_t distRIV2alloc_gap0_odd_LUT100_0[6000];
|
||||
extern uint32_t distRIV2alloc_gap0_even_LUT100_1[6000];
|
||||
extern uint32_t distRIV2alloc_gap0_odd_LUT100_1[6000];
|
||||
extern uint32_t distRIV2alloc_gap0_even_LUT100_2[6000];
|
||||
extern uint32_t distRIV2alloc_gap0_odd_LUT100_2[6000];
|
||||
extern uint32_t distRIV2alloc_gap0_even_LUT100_3[6000];
|
||||
extern uint32_t distRIV2alloc_gap0_odd_LUT100_3[6000];
|
||||
extern uint32_t distRIV2alloc_gap1_even_LUT100_0[6000];
|
||||
extern uint32_t distRIV2alloc_gap1_odd_LUT100_0[6000];
|
||||
extern uint32_t distRIV2alloc_gap1_even_LUT100_1[6000];
|
||||
extern uint32_t distRIV2alloc_gap1_odd_LUT100_1[6000];
|
||||
extern uint32_t distRIV2alloc_gap1_even_LUT100_2[6000];
|
||||
extern uint32_t distRIV2alloc_gap1_odd_LUT100_2[6000];
|
||||
extern uint32_t distRIV2alloc_gap1_even_LUT100_3[6000];
|
||||
extern uint32_t distRIV2alloc_gap1_odd_LUT100_3[6000];
|
||||
extern uint16_t RIV2nb_rb_LUT100[6000];
|
||||
extern uint16_t RIV2first_rb_LUT100[6000];
|
||||
extern uint16_t RIV_max100;
|
||||
|
||||
extern int8_t *delta_PUCCH_lut;
|
||||
extern int8_t delta_PUSCH_acc[4];
|
||||
extern int8_t delta_PUSCH_abs[4];
|
||||
@@ -30,15 +30,14 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/CODING/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "PHY/LTE_TRANSPORT/defs.h"
|
||||
#include "PHY/LTE_TRANSPORT/proto.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "defs.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include <syscall.h>
|
||||
@@ -398,12 +397,12 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *te_wait_stats,
|
||||
time_stats_t *te_main_stats,
|
||||
time_stats_t *te_wakeup_stats0,
|
||||
time_stats_t *te_wakeup_stats1,
|
||||
time_stats_t *i_stats,
|
||||
int worker_num)
|
||||
time_stats_t *te_wait_stats,
|
||||
time_stats_t *te_main_stats,
|
||||
time_stats_t *te_wakeup_stats0,
|
||||
time_stats_t *te_wakeup_stats1,
|
||||
time_stats_t *i_stats,
|
||||
int worker_num)
|
||||
{
|
||||
|
||||
//start_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||
@@ -900,186 +899,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
|
||||
int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
unsigned char *a,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *i_stats)
|
||||
{
|
||||
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
unsigned short iind;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
unsigned char harq_pid = ue->dlsch[subframe&2][0][0]->rnti;
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int A;
|
||||
unsigned char mod_order;
|
||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||
uint8_t beamforming_mode=0;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||
|
||||
A = dlsch->harq_processes[harq_pid]->TBS; //6228
|
||||
// printf("Encoder: A: %d\n",A);
|
||||
mod_order = dlsch->harq_processes[harq_pid]->Qm;
|
||||
|
||||
if(dlsch->harq_processes[harq_pid]->mimo_mode == TM7)
|
||||
beamforming_mode = 7;
|
||||
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM8)
|
||||
beamforming_mode = 8;
|
||||
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10)
|
||||
beamforming_mode = 9;
|
||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode);
|
||||
|
||||
|
||||
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
|
||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("SIC encoding thinks this is a new packet \n");
|
||||
#endif
|
||||
/*
|
||||
int i;
|
||||
printf("dlsch (tx): \n");
|
||||
for (i=0;i<(A>>3);i++)
|
||||
printf("%02x.",a[i]);
|
||||
printf("\n");
|
||||
*/
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
crc = crc24a(a,
|
||||
A)>>8;
|
||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
||||
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
||||
// printf("CRC %x (A %d)\n",crc,A);
|
||||
|
||||
dlsch->harq_processes[harq_pid]->B = A+24;
|
||||
// dlsch->harq_processes[harq_pid]->b = a;
|
||||
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
|
||||
|
||||
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b,
|
||||
dlsch->harq_processes[harq_pid]->c,
|
||||
dlsch->harq_processes[harq_pid]->B,
|
||||
&dlsch->harq_processes[harq_pid]->C,
|
||||
&dlsch->harq_processes[harq_pid]->Cplus,
|
||||
&dlsch->harq_processes[harq_pid]->Cminus,
|
||||
&dlsch->harq_processes[harq_pid]->Kplus,
|
||||
&dlsch->harq_processes[harq_pid]->Kminus,
|
||||
&dlsch->harq_processes[harq_pid]->F)<0)
|
||||
return(-1);
|
||||
|
||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
|
||||
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
||||
else
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
|
||||
// generate codewords
|
||||
|
||||
printf("bits_per_codeword (Kr)= %d, A %d\n",Kr,A);
|
||||
printf("N_RB = %d\n",nb_rb);
|
||||
printf("Ncp %d\n",frame_parms->Ncp);
|
||||
printf("mod_order %d\n",mod_order);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
|
||||
#endif
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
|
||||
);
|
||||
stop_meas(te_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
if (r==0)
|
||||
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
|
||||
|
||||
#endif
|
||||
start_meas(i_stats);
|
||||
dlsch->harq_processes[harq_pid]->RTC[r] =
|
||||
sub_block_interleaving_turbo(4+(Kr_bytes*8),
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
dlsch->harq_processes[harq_pid]->w[r]);
|
||||
stop_meas(i_stats);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||
// outputs for each code segment, see Section 5.1.5 p.20
|
||||
|
||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
|
||||
r,
|
||||
G,
|
||||
Kr*3,
|
||||
mod_order,nb_rb);
|
||||
#endif
|
||||
|
||||
start_meas(rm_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("rvidx in SIC encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
|
||||
#endif
|
||||
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
||||
G, //G
|
||||
dlsch->harq_processes[harq_pid]->w[r],
|
||||
dlsch->harq_processes[harq_pid]->e+r_offset,
|
||||
dlsch->harq_processes[harq_pid]->C, // C
|
||||
dlsch->Nsoft, // Nsoft,
|
||||
dlsch->Mdlharq,
|
||||
dlsch->Kmimo,
|
||||
dlsch->harq_processes[harq_pid]->rvidx,
|
||||
dlsch->harq_processes[harq_pid]->Qm,
|
||||
dlsch->harq_processes[harq_pid]->Nl,
|
||||
r,
|
||||
nb_rb);
|
||||
// m); // r
|
||||
stop_meas(rm_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
if (r==dlsch->harq_processes[harq_pid]->C-1)
|
||||
write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/CODING/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "PHY/LTE_TRANSPORT/defs.h"
|
||||
#include "defs.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
|
||||
//#define DEBUG_DLSCH_MODULATION
|
||||
#define NEW_ALLOC_RE
|
||||
@@ -95,42 +95,7 @@ uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp,
|
||||
return(0);
|
||||
}
|
||||
|
||||
void generate_64qam_table(void)
|
||||
{
|
||||
|
||||
int a,b,c,index;
|
||||
|
||||
|
||||
for (a=-1; a<=1; a+=2)
|
||||
for (b=-1; b<=1; b+=2)
|
||||
for (c=-1; c<=1; c+=2) {
|
||||
index = (1+a)*2 + (1+b) + (1+c)/2;
|
||||
qam64_table[index] = -a*(QAM64_n1 + b*(QAM64_n2 + (c*QAM64_n3))); // 0 1 2
|
||||
}
|
||||
}
|
||||
|
||||
void generate_16qam_table(void)
|
||||
{
|
||||
|
||||
int a,b,index;
|
||||
|
||||
for (a=-1; a<=1; a+=2)
|
||||
for (b=-1; b<=1; b+=2) {
|
||||
index = (1+a) + (1+b)/2;
|
||||
qam16_table[index] = -a*(QAM16_n1 + (b*QAM16_n2));
|
||||
}
|
||||
}
|
||||
|
||||
void generate_qpsk_table(void)
|
||||
{
|
||||
|
||||
int a,index;
|
||||
|
||||
for (a=-1; a<=1; a+=2) {
|
||||
index = (1+a)/2;
|
||||
qpsk_table[index] = -a*QPSK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1970,48 +1935,6 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
|
||||
return(0);
|
||||
}
|
||||
|
||||
uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb)
|
||||
{
|
||||
/*
|
||||
MIMO_mode_t mode = dlsch_harq->mimo_mode;
|
||||
uint32_t pmi_alloc = dlsch_harq->pmi_alloc;
|
||||
*/
|
||||
|
||||
switch (N_RB_DL) {
|
||||
case 6: // 1 PRB per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>(rb<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>rb)&1);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
case 25: // 4 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb>>2)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb>>2))&1);
|
||||
|
||||
break;
|
||||
|
||||
case 50: // 6 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb/6)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb/6))&1);
|
||||
|
||||
break;
|
||||
|
||||
case 100: // 8 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb>>3)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb>>3))&1);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms,int l,int nsymb) __attribute__((always_inline));
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
|
||||
//#define DEBUG_SCRAMBLING 1
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/CODING/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "defs.h"
|
||||
#include "extern.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "transport_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
static inline unsigned int lte_gold_scram(unsigned int *x1, unsigned int *x2, unsigned char reset) __attribute__((always_inline));
|
||||
@@ -87,7 +87,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN);
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
// Rule for accumulation of subframes for BL/CE UEs
|
||||
uint8_t Nacc=4;
|
||||
uint16_t j0,j,idelta;
|
||||
@@ -110,7 +110,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
// reset = 1;
|
||||
// x1 is set in lte_gold_generic
|
||||
if (mbsfn_flag == 0) {
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (dlsch->i0 != 0xFFFF) {
|
||||
// rule for BL/CE UEs from Section 6.3.1 in 36.211
|
||||
x2= (dlsch->rnti<<14) + (q<<13) + ((((j0+j)*Nacc)%10)<<9) + frame_parms->Nid_cell;
|
||||
@@ -124,7 +124,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SCRAMBLING
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
|
||||
#else
|
||||
printf("scrambling: rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
|
||||
@@ -187,6 +187,20 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void init_scrambling_lut(void) {
|
||||
|
||||
uint32_t s;
|
||||
int i=0,j;
|
||||
|
||||
for (s=0;s<=65535;s++) {
|
||||
for (j=0;j<16;j++) {
|
||||
scrambling_lut[i++] = (uint8_t)((s>>j)&1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int mbsfn_flag,
|
||||
LTE_UE_DLSCH_t *dlsch,
|
||||
@@ -228,7 +242,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
}
|
||||
|
||||
void init_unscrambling_lut() {
|
||||
void init_unscrambling_lut(void) {
|
||||
|
||||
uint32_t s;
|
||||
int i=0,j;
|
||||
@@ -239,15 +253,3 @@ void init_unscrambling_lut() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_scrambling_lut() {
|
||||
|
||||
uint32_t s;
|
||||
int i=0,j;
|
||||
|
||||
for (s=0;s<=65535;s++) {
|
||||
for (j=0;j<16;j++) {
|
||||
scrambling_lut[i++] = (uint8_t)((s>>j)&1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,21 +32,23 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "SIMULATION/TOOLS/defs.h" // for taus
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
#include "PHY/sse_intrin.h"
|
||||
|
||||
#include "transport_proto.h"
|
||||
#include "transport_common_proto.h"
|
||||
#include "assertions.h"
|
||||
#include "T.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
//#define DEBUG_DCI_ENCODING 1
|
||||
//#define DEBUG_DCI_DECODING 1
|
||||
//#define DEBUG_PHY
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
void generate_edci_top(PHY_VARS_eNB *eNB, int frame, int subframe) {
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
//#define DEBUG_GROUPHOP 1
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/TOOLS/alaw_lut.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
|
||||
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
|
||||
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
|
||||
@@ -47,7 +47,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
|
||||
int32_t **txdataF = ru->common.txdataF_BF;
|
||||
int32_t **rxdataF = ru->common.rxdataF;
|
||||
int16_t **prach_rxsigF = ru->prach_rxsigF;
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
|
||||
#endif
|
||||
void *tx_buffer = ru->ifbuffer.tx[subframe&1];
|
||||
@@ -230,8 +230,9 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
|
||||
|
||||
int16_t *rxF;
|
||||
|
||||
|
||||
for (int antenna_id=0;antenna_id<ru->nb_rx;antenna_id++) {
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (packet_type > IF4p5_PRACH)
|
||||
rxF = &prach_rxsigF_br[packet_type - IF4p5_PRACH - 1][0][0];
|
||||
else
|
||||
@@ -273,7 +274,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
|
||||
int32_t **txdataF = ru->common.txdataF_BF;
|
||||
int32_t **rxdataF = ru->common.rxdataF;
|
||||
int16_t **prach_rxsigF = ru->prach_rxsigF;
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
|
||||
#endif
|
||||
void *rx_buffer = ru->ifbuffer.rx;
|
||||
@@ -383,9 +384,9 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
|
||||
*packet_type <= IF4p5_PRACH + 4) {
|
||||
|
||||
int16_t *rxF;
|
||||
|
||||
|
||||
for (int antenna_id=0;antenna_id<ru->nb_rx;antenna_id++) {
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (*packet_type > IF4p5_PRACH)
|
||||
rxF = &prach_rxsigF_br[*packet_type - IF4p5_PRACH - 1][antenna_id][0];
|
||||
else
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#ifndef __IF4_TOOLS_H__
|
||||
#define __IF4_TOOLS_H__
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
|
||||
/// Macro for IF4 packet type
|
||||
#define IF4p5_PACKET_TYPE 0x080A
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/TOOLS/alaw_lut.h"
|
||||
|
||||
#include "time_utils.h"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define __IF5_TOOLS_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
|
||||
#define IF5_RRH_GW_DL 0x0022
|
||||
#define IF5_RRH_GW_UL 0x0023
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/LTE_TRANSPORT/proto.h"
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
|
||||
unsigned char get_Qm(unsigned char I_MCS)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef __M_DCI__H__
|
||||
#define __M_DCI__H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -467,3 +470,4 @@ struct DCI6_2_di_20MHz {
|
||||
typedef struct DCI6_2_di_20MHz DCI6_2_di_20MHz_t;
|
||||
#define sizeof_DCI6_2_20MHz_t 13
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,13 +29,14 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/CODING/extern.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "defs.h"
|
||||
#include "extern.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "transport_eNB.h"
|
||||
#include "transport_proto.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
//#define DEBUG_PBCH 1
|
||||
//#define DEBUG_PBCH_ENCODING
|
||||
@@ -138,6 +139,31 @@ int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
return(0);
|
||||
}
|
||||
|
||||
void pbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t *pbch_e,
|
||||
uint32_t length)
|
||||
{
|
||||
int i;
|
||||
uint8_t reset;
|
||||
uint32_t x1, x2, s=0;
|
||||
|
||||
reset = 1;
|
||||
// x1 is set in lte_gold_generic
|
||||
x2 = frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.6.1
|
||||
// msg("pbch_scrambling: Nid_cell = %d\n",x2);
|
||||
|
||||
for (i=0; i<length; i++) {
|
||||
if ((i&0x1f)==0) {
|
||||
s = lte_gold_generic(&x1, &x2, reset);
|
||||
// printf("lte_gold[%d]=%x\n",i,s);
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
pbch_e[i] = (pbch_e[i]&1) ^ ((s>>(i&0x1f))&1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//uint8_t pbch_d[96+(3*(16+PBCH_A))], pbch_w[3*3*(16+PBCH_A)],pbch_e[1920]; //one bit per byte
|
||||
int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
|
||||
int32_t **txdataF,
|
||||
@@ -393,623 +419,5 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
|
||||
return(0);
|
||||
}
|
||||
|
||||
int32_t generate_pbch_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t *pbch_pdu)
|
||||
{
|
||||
|
||||
LOG_D(PHY,"[eNB %d] generate_pbch_emul \n",phy_vars_eNB->Mod_id);
|
||||
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].cntl.pbch_flag=1;
|
||||
// Copy PBCH payload
|
||||
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].cntl.pbch_payload=*(uint32_t *)pbch_pdu;
|
||||
return(0);
|
||||
}
|
||||
|
||||
uint16_t pbch_extract(int **rxdataF,
|
||||
int **dl_ch_estimates,
|
||||
int **rxdataF_ext,
|
||||
int **dl_ch_estimates_ext,
|
||||
uint32_t symbol,
|
||||
uint32_t high_speed_flag,
|
||||
LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
|
||||
uint16_t rb,nb_rb=6;
|
||||
uint8_t i,j,aarx,aatx;
|
||||
int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext;
|
||||
|
||||
uint32_t nsymb = (frame_parms->Ncp==0) ? 7:6;
|
||||
uint32_t symbol_mod = symbol % nsymb;
|
||||
|
||||
int rx_offset = frame_parms->ofdm_symbol_size-3*12;
|
||||
int ch_offset = frame_parms->N_RB_DL*6-3*12;
|
||||
int nushiftmod3 = frame_parms->nushift%3;
|
||||
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
/*
|
||||
printf("extract_rbs (nushift %d): symbol_mod=%d, rx_offset=%d, ch_offset=%d\n",frame_parms->nushift,symbol_mod,
|
||||
(rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))*2,
|
||||
LTE_CE_OFFSET+ch_offset+(symbol_mod*(frame_parms->ofdm_symbol_size)));
|
||||
*/
|
||||
|
||||
rxF = &rxdataF[aarx][(rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))];
|
||||
rxF_ext = &rxdataF_ext[aarx][symbol_mod*(6*12)];
|
||||
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
// skip DC carrier
|
||||
if (rb==3) {
|
||||
rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))];
|
||||
}
|
||||
|
||||
if ((symbol_mod==0) || (symbol_mod==1)) {
|
||||
j=0;
|
||||
|
||||
for (i=0; i<12; i++) {
|
||||
if ((i!=nushiftmod3) &&
|
||||
(i!=(nushiftmod3+3)) &&
|
||||
(i!=(nushiftmod3+6)) &&
|
||||
(i!=(nushiftmod3+9))) {
|
||||
rxF_ext[j++]=rxF[i];
|
||||
}
|
||||
}
|
||||
|
||||
rxF+=12;
|
||||
rxF_ext+=8;
|
||||
} else {
|
||||
for (i=0; i<12; i++) {
|
||||
rxF_ext[i]=rxF[i];
|
||||
}
|
||||
|
||||
rxF+=12;
|
||||
rxF_ext+=12;
|
||||
}
|
||||
}
|
||||
|
||||
for (aatx=0; aatx<4; aatx++) { //frame_parms->nb_antenna_ports_eNB;aatx++) {
|
||||
if (high_speed_flag == 1)
|
||||
dl_ch0 = &dl_ch_estimates[(aatx<<1)+aarx][LTE_CE_OFFSET+ch_offset+(symbol*(frame_parms->ofdm_symbol_size))];
|
||||
else
|
||||
dl_ch0 = &dl_ch_estimates[(aatx<<1)+aarx][LTE_CE_OFFSET+ch_offset];
|
||||
|
||||
dl_ch0_ext = &dl_ch_estimates_ext[(aatx<<1)+aarx][symbol_mod*(6*12)];
|
||||
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
// skip DC carrier
|
||||
// if (rb==3) dl_ch0++;
|
||||
if (symbol_mod>1) {
|
||||
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
|
||||
dl_ch0+=12;
|
||||
dl_ch0_ext+=12;
|
||||
} else {
|
||||
j=0;
|
||||
|
||||
for (i=0; i<12; i++) {
|
||||
if ((i!=nushiftmod3) &&
|
||||
(i!=(nushiftmod3+3)) &&
|
||||
(i!=(nushiftmod3+6)) &&
|
||||
(i!=(nushiftmod3+9))) {
|
||||
// printf("PBCH extract i %d j %d => (%d,%d)\n",i,j,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i]));
|
||||
dl_ch0_ext[j++]=dl_ch0[i];
|
||||
}
|
||||
}
|
||||
|
||||
dl_ch0+=12;
|
||||
dl_ch0_ext+=8;
|
||||
}
|
||||
}
|
||||
} //tx antenna loop
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
//__m128i avg128;
|
||||
|
||||
//compute average channel_level on each (TX,RX) antenna pair
|
||||
int pbch_channel_level(int **dl_ch_estimates_ext,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint32_t symbol)
|
||||
{
|
||||
|
||||
int16_t rb, nb_rb=6;
|
||||
uint8_t aatx,aarx;
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i avg128;
|
||||
__m128i *dl_ch128;
|
||||
#elif defined(__arm__)
|
||||
int32x4_t avg128;
|
||||
int16x8_t *dl_ch128;
|
||||
#endif
|
||||
int avg1=0,avg2=0;
|
||||
|
||||
uint32_t nsymb = (frame_parms->Ncp==0) ? 7:6;
|
||||
uint32_t symbol_mod = symbol % nsymb;
|
||||
|
||||
for (aatx=0; aatx<4; aatx++) //frame_parms->nb_antenna_ports_eNB;aatx++)
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
//clear average level
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
avg128 = _mm_setzero_si128();
|
||||
dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol_mod*6*12];
|
||||
#elif defined(__arm__)
|
||||
avg128 = vdupq_n_s32(0);
|
||||
dl_ch128=(int16x8_t *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol_mod*6*12];
|
||||
|
||||
#endif
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[0],dl_ch128[0]));
|
||||
avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[1],dl_ch128[1]));
|
||||
avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[2],dl_ch128[2]));
|
||||
#elif defined(__arm__)
|
||||
// to be filled in
|
||||
#endif
|
||||
dl_ch128+=3;
|
||||
/*
|
||||
if (rb==0) {
|
||||
print_shorts("dl_ch128",&dl_ch128[0]);
|
||||
print_shorts("dl_ch128",&dl_ch128[1]);
|
||||
print_shorts("dl_ch128",&dl_ch128[2]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
avg1 = (((int*)&avg128)[0] +
|
||||
((int*)&avg128)[1] +
|
||||
((int*)&avg128)[2] +
|
||||
((int*)&avg128)[3])/(nb_rb*12);
|
||||
|
||||
if (avg1>avg2)
|
||||
avg2 = avg1;
|
||||
|
||||
//msg("Channel level : %d, %d\n",avg1, avg2);
|
||||
}
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
#endif
|
||||
return(avg2);
|
||||
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i mmtmpP0,mmtmpP1,mmtmpP2,mmtmpP3;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t mmtmpP0,mmtmpP1,mmtmpP2,mmtmpP3;
|
||||
#endif
|
||||
void pbch_channel_compensation(int **rxdataF_ext,
|
||||
int **dl_ch_estimates_ext,
|
||||
int **rxdataF_comp,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t symbol,
|
||||
uint8_t output_shift)
|
||||
{
|
||||
|
||||
uint16_t rb,nb_rb=6;
|
||||
uint8_t aatx,aarx,symbol_mod;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *dl_ch128,*rxdataF128,*rxdataF_comp128;
|
||||
#elif defined(__arm__)
|
||||
|
||||
#endif
|
||||
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
|
||||
|
||||
for (aatx=0; aatx<4; aatx++) //frame_parms->nb_antenna_ports_eNB;aatx++)
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol_mod*6*12];
|
||||
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol_mod*6*12];
|
||||
rxdataF_comp128 = (__m128i *)&rxdataF_comp[(aatx<<1)+aarx][symbol_mod*6*12];
|
||||
|
||||
#elif defined(__arm__)
|
||||
// to be filled in
|
||||
#endif
|
||||
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
//printf("rb %d\n",rb);
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
// multiply by conjugated channel
|
||||
mmtmpP0 = _mm_madd_epi16(dl_ch128[0],rxdataF128[0]);
|
||||
// print_ints("re",&mmtmpP0);
|
||||
// mmtmpP0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpP1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpP1 = _mm_shufflehi_epi16(mmtmpP1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpP1 = _mm_sign_epi16(mmtmpP1,*(__m128i*)&conjugate[0]);
|
||||
// print_ints("im",&mmtmpP1);
|
||||
mmtmpP1 = _mm_madd_epi16(mmtmpP1,rxdataF128[0]);
|
||||
// mmtmpP1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpP0 = _mm_srai_epi32(mmtmpP0,output_shift);
|
||||
// print_ints("re(shift)",&mmtmpP0);
|
||||
mmtmpP1 = _mm_srai_epi32(mmtmpP1,output_shift);
|
||||
// print_ints("im(shift)",&mmtmpP1);
|
||||
mmtmpP2 = _mm_unpacklo_epi32(mmtmpP0,mmtmpP1);
|
||||
mmtmpP3 = _mm_unpackhi_epi32(mmtmpP0,mmtmpP1);
|
||||
// print_ints("c0",&mmtmpP2);
|
||||
// print_ints("c1",&mmtmpP3);
|
||||
rxdataF_comp128[0] = _mm_packs_epi32(mmtmpP2,mmtmpP3);
|
||||
// print_shorts("rx:",rxdataF128);
|
||||
// print_shorts("ch:",dl_ch128);
|
||||
// print_shorts("pack:",rxdataF_comp128);
|
||||
|
||||
// multiply by conjugated channel
|
||||
mmtmpP0 = _mm_madd_epi16(dl_ch128[1],rxdataF128[1]);
|
||||
// mmtmpP0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpP1 = _mm_shufflelo_epi16(dl_ch128[1],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpP1 = _mm_shufflehi_epi16(mmtmpP1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpP1 = _mm_sign_epi16(mmtmpP1,*(__m128i*)&conjugate[0]);
|
||||
mmtmpP1 = _mm_madd_epi16(mmtmpP1,rxdataF128[1]);
|
||||
// mmtmpP1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpP0 = _mm_srai_epi32(mmtmpP0,output_shift);
|
||||
mmtmpP1 = _mm_srai_epi32(mmtmpP1,output_shift);
|
||||
mmtmpP2 = _mm_unpacklo_epi32(mmtmpP0,mmtmpP1);
|
||||
mmtmpP3 = _mm_unpackhi_epi32(mmtmpP0,mmtmpP1);
|
||||
rxdataF_comp128[1] = _mm_packs_epi32(mmtmpP2,mmtmpP3);
|
||||
// print_shorts("rx:",rxdataF128+1);
|
||||
// print_shorts("ch:",dl_ch128+1);
|
||||
// print_shorts("pack:",rxdataF_comp128+1);
|
||||
|
||||
if (symbol_mod>1) {
|
||||
// multiply by conjugated channel
|
||||
mmtmpP0 = _mm_madd_epi16(dl_ch128[2],rxdataF128[2]);
|
||||
// mmtmpP0 contains real part of 4 consecutive outputs (32-bit)
|
||||
mmtmpP1 = _mm_shufflelo_epi16(dl_ch128[2],_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpP1 = _mm_shufflehi_epi16(mmtmpP1,_MM_SHUFFLE(2,3,0,1));
|
||||
mmtmpP1 = _mm_sign_epi16(mmtmpP1,*(__m128i*)&conjugate[0]);
|
||||
mmtmpP1 = _mm_madd_epi16(mmtmpP1,rxdataF128[2]);
|
||||
// mmtmpP1 contains imag part of 4 consecutive outputs (32-bit)
|
||||
mmtmpP0 = _mm_srai_epi32(mmtmpP0,output_shift);
|
||||
mmtmpP1 = _mm_srai_epi32(mmtmpP1,output_shift);
|
||||
mmtmpP2 = _mm_unpacklo_epi32(mmtmpP0,mmtmpP1);
|
||||
mmtmpP3 = _mm_unpackhi_epi32(mmtmpP0,mmtmpP1);
|
||||
rxdataF_comp128[2] = _mm_packs_epi32(mmtmpP2,mmtmpP3);
|
||||
// print_shorts("rx:",rxdataF128+2);
|
||||
// print_shorts("ch:",dl_ch128+2);
|
||||
// print_shorts("pack:",rxdataF_comp128+2);
|
||||
|
||||
dl_ch128+=3;
|
||||
rxdataF128+=3;
|
||||
rxdataF_comp128+=3;
|
||||
} else {
|
||||
dl_ch128+=2;
|
||||
rxdataF128+=2;
|
||||
rxdataF_comp128+=2;
|
||||
}
|
||||
#elif defined(__arm__)
|
||||
// to be filled in
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
#endif
|
||||
}
|
||||
|
||||
void pbch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int **rxdataF_comp,
|
||||
uint8_t symbol)
|
||||
{
|
||||
|
||||
uint8_t aatx, symbol_mod;
|
||||
int i, nb_rb=6;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *rxdataF_comp128_0,*rxdataF_comp128_1;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *rxdataF_comp128_0,*rxdataF_comp128_1;
|
||||
#endif
|
||||
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
|
||||
|
||||
if (frame_parms->nb_antennas_rx>1) {
|
||||
for (aatx=0; aatx<4; aatx++) { //frame_parms->nb_antenna_ports_eNB;aatx++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[(aatx<<1)][symbol_mod*6*12];
|
||||
rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[(aatx<<1)+1][symbol_mod*6*12];
|
||||
#elif defined(__arm__)
|
||||
rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[(aatx<<1)][symbol_mod*6*12];
|
||||
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[(aatx<<1)+1][symbol_mod*6*12];
|
||||
|
||||
#endif
|
||||
// MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
|
||||
for (i=0; i<nb_rb*3; i++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
rxdataF_comp128_0[i] = _mm_adds_epi16(_mm_srai_epi16(rxdataF_comp128_0[i],1),_mm_srai_epi16(rxdataF_comp128_1[i],1));
|
||||
#elif defined(__arm__)
|
||||
rxdataF_comp128_0[i] = vhaddq_s16(rxdataF_comp128_0[i],rxdataF_comp128_1[i]);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
#endif
|
||||
}
|
||||
|
||||
void pbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t *pbch_e,
|
||||
uint32_t length)
|
||||
{
|
||||
int i;
|
||||
uint8_t reset;
|
||||
uint32_t x1, x2, s=0;
|
||||
|
||||
reset = 1;
|
||||
// x1 is set in lte_gold_generic
|
||||
x2 = frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.6.1
|
||||
// msg("pbch_scrambling: Nid_cell = %d\n",x2);
|
||||
|
||||
for (i=0; i<length; i++) {
|
||||
if ((i&0x1f)==0) {
|
||||
s = lte_gold_generic(&x1, &x2, reset);
|
||||
// printf("lte_gold[%d]=%x\n",i,s);
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
pbch_e[i] = (pbch_e[i]&1) ^ ((s>>(i&0x1f))&1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void pbch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int8_t* llr,
|
||||
uint32_t length,
|
||||
uint8_t frame_mod4)
|
||||
{
|
||||
int i;
|
||||
uint8_t reset;
|
||||
uint32_t x1, x2, s=0;
|
||||
|
||||
reset = 1;
|
||||
// x1 is set in first call to lte_gold_generic
|
||||
x2 = frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.6.1
|
||||
// msg("pbch_unscrambling: Nid_cell = %d\n",x2);
|
||||
|
||||
for (i=0; i<length; i++) {
|
||||
if (i%32==0) {
|
||||
s = lte_gold_generic(&x1, &x2, reset);
|
||||
// printf("lte_gold[%d]=%x\n",i,s);
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
// take the quarter of the PBCH that corresponds to this frame
|
||||
if ((i>=(frame_mod4*(length>>2))) && (i<((1+frame_mod4)*(length>>2)))) {
|
||||
|
||||
if (((s>>(i%32))&1)==0)
|
||||
llr[i] = -llr[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pbch_alamouti(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int **rxdataF_comp,
|
||||
uint8_t symbol)
|
||||
{
|
||||
|
||||
|
||||
int16_t *rxF0,*rxF1;
|
||||
// __m128i *ch_mag0,*ch_mag1,*ch_mag0b,*ch_mag1b;
|
||||
uint8_t rb,re,symbol_mod;
|
||||
int jj;
|
||||
|
||||
// printf("Doing alamouti\n");
|
||||
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
|
||||
jj = (symbol_mod*6*12);
|
||||
|
||||
rxF0 = (int16_t*)&rxdataF_comp[0][jj]; //tx antenna 0 h0*y
|
||||
rxF1 = (int16_t*)&rxdataF_comp[2][jj]; //tx antenna 1 h1*y
|
||||
|
||||
for (rb=0; rb<6; rb++) {
|
||||
|
||||
for (re=0; re<12; re+=2) {
|
||||
|
||||
// Alamouti RX combining
|
||||
|
||||
rxF0[0] = rxF0[0] + rxF1[2];
|
||||
rxF0[1] = rxF0[1] - rxF1[3];
|
||||
|
||||
rxF0[2] = rxF0[2] - rxF1[0];
|
||||
rxF0[3] = rxF0[3] + rxF1[1];
|
||||
|
||||
rxF0+=4;
|
||||
rxF1+=4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void pbch_quantize(int8_t *pbch_llr8,
|
||||
int16_t *pbch_llr,
|
||||
uint16_t len)
|
||||
{
|
||||
|
||||
uint16_t i;
|
||||
|
||||
for (i=0; i<len; i++) {
|
||||
if (pbch_llr[i]>7)
|
||||
pbch_llr8[i]=7;
|
||||
else if (pbch_llr[i]<-8)
|
||||
pbch_llr8[i]=-8;
|
||||
else
|
||||
pbch_llr8[i] = (char)(pbch_llr[i]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned char dummy_w_rx[3*3*(16+PBCH_A)];
|
||||
static int8_t pbch_w_rx[3*3*(16+PBCH_A)],pbch_d_rx[96+(3*(16+PBCH_A))];
|
||||
|
||||
|
||||
uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
|
||||
LTE_UE_PBCH *lte_ue_pbch_vars,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t eNB_id,
|
||||
MIMO_mode_t mimo_mode,
|
||||
uint32_t high_speed_flag,
|
||||
uint8_t frame_mod4)
|
||||
{
|
||||
|
||||
uint8_t log2_maxh;//,aatx,aarx;
|
||||
int max_h=0;
|
||||
|
||||
int symbol,i;
|
||||
uint32_t nsymb = (frame_parms->Ncp==0) ? 14:12;
|
||||
uint16_t pbch_E;
|
||||
uint8_t pbch_a[8];
|
||||
uint8_t RCC;
|
||||
|
||||
int8_t *pbch_e_rx;
|
||||
uint8_t *decoded_output = lte_ue_pbch_vars->decoded_output;
|
||||
uint16_t crc;
|
||||
|
||||
|
||||
// pbch_D = 16+PBCH_A;
|
||||
|
||||
pbch_E = (frame_parms->Ncp==0) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
|
||||
pbch_e_rx = <e_ue_pbch_vars->llr[frame_mod4*(pbch_E>>2)];
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_D(PHY,"[PBCH] starting symbol loop (Ncp %d, frame_mod4 %d,mimo_mode %d\n",frame_parms->Ncp,frame_mod4,mimo_mode);
|
||||
#endif
|
||||
|
||||
// clear LLR buffer
|
||||
memset(lte_ue_pbch_vars->llr,0,pbch_E);
|
||||
|
||||
for (symbol=(nsymb>>1); symbol<(nsymb>>1)+4; symbol++) {
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_D(PHY,"[PBCH] starting extract\n");
|
||||
#endif
|
||||
pbch_extract(lte_ue_common_vars->common_vars_rx_data_per_thread[0].rxdataF,
|
||||
lte_ue_common_vars->common_vars_rx_data_per_thread[0].dl_ch_estimates[eNB_id],
|
||||
lte_ue_pbch_vars->rxdataF_ext,
|
||||
lte_ue_pbch_vars->dl_ch_estimates_ext,
|
||||
symbol,
|
||||
high_speed_flag,
|
||||
frame_parms);
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_D(PHY,"[PHY] PBCH Symbol %d\n",symbol);
|
||||
LOG_D(PHY,"[PHY] PBCH starting channel_level\n");
|
||||
#endif
|
||||
|
||||
max_h = pbch_channel_level(lte_ue_pbch_vars->dl_ch_estimates_ext,
|
||||
frame_parms,
|
||||
symbol);
|
||||
log2_maxh = 3+(log2_approx(max_h)/2);
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_D(PHY,"[PHY] PBCH log2_maxh = %d (%d)\n",log2_maxh,max_h);
|
||||
#endif
|
||||
|
||||
pbch_channel_compensation(lte_ue_pbch_vars->rxdataF_ext,
|
||||
lte_ue_pbch_vars->dl_ch_estimates_ext,
|
||||
lte_ue_pbch_vars->rxdataF_comp,
|
||||
frame_parms,
|
||||
symbol,
|
||||
log2_maxh); // log2_maxh+I0_shift
|
||||
|
||||
if (frame_parms->nb_antennas_rx > 1)
|
||||
pbch_detection_mrc(frame_parms,
|
||||
lte_ue_pbch_vars->rxdataF_comp,
|
||||
symbol);
|
||||
|
||||
|
||||
if (mimo_mode == ALAMOUTI) {
|
||||
pbch_alamouti(frame_parms,lte_ue_pbch_vars->rxdataF_comp,symbol);
|
||||
} else if (mimo_mode != SISO) {
|
||||
LOG_D(PHY,"[PBCH][RX] Unsupported MIMO mode\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (symbol>(nsymb>>1)+1) {
|
||||
pbch_quantize(pbch_e_rx,
|
||||
(short*)&(lte_ue_pbch_vars->rxdataF_comp[0][(symbol%(nsymb>>1))*72]),
|
||||
144);
|
||||
|
||||
pbch_e_rx+=144;
|
||||
} else {
|
||||
pbch_quantize(pbch_e_rx,
|
||||
(short*)&(lte_ue_pbch_vars->rxdataF_comp[0][(symbol%(nsymb>>1))*72]),
|
||||
96);
|
||||
|
||||
pbch_e_rx+=96;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
pbch_e_rx = lte_ue_pbch_vars->llr;
|
||||
|
||||
|
||||
|
||||
//un-scrambling
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_D(PHY,"[PBCH] doing unscrambling\n");
|
||||
#endif
|
||||
|
||||
|
||||
pbch_unscrambling(frame_parms,
|
||||
pbch_e_rx,
|
||||
pbch_E,
|
||||
frame_mod4);
|
||||
|
||||
|
||||
|
||||
//un-rate matching
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_D(PHY,"[PBCH] doing un-rate-matching\n");
|
||||
#endif
|
||||
|
||||
|
||||
memset(dummy_w_rx,0,3*3*(16+PBCH_A));
|
||||
RCC = generate_dummy_w_cc(16+PBCH_A,
|
||||
dummy_w_rx);
|
||||
|
||||
|
||||
lte_rate_matching_cc_rx(RCC,pbch_E,pbch_w_rx,dummy_w_rx,pbch_e_rx);
|
||||
|
||||
sub_block_deinterleaving_cc((unsigned int)(PBCH_A+16),
|
||||
&pbch_d_rx[96],
|
||||
&pbch_w_rx[0]);
|
||||
|
||||
memset(pbch_a,0,((16+PBCH_A)>>3));
|
||||
|
||||
|
||||
|
||||
|
||||
phy_viterbi_lte_sse2(pbch_d_rx+96,pbch_a,16+PBCH_A);
|
||||
|
||||
// Fix byte endian of PBCH (bit 23 goes in first)
|
||||
for (i=0; i<(PBCH_A>>3); i++)
|
||||
decoded_output[(PBCH_A>>3)-i-1] = pbch_a[i];
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
|
||||
for (i=0; i<(PBCH_A>>3); i++)
|
||||
LOG_I(PHY,"[PBCH] pbch_a[%d] = %x\n",i,decoded_output[i]);
|
||||
|
||||
#endif //DEBUG_PBCH
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_I(PHY,"PBCH CRC %x : %x\n",
|
||||
crc16(pbch_a,PBCH_A),
|
||||
((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]);
|
||||
#endif
|
||||
|
||||
crc = (crc16(pbch_a,PBCH_A)>>16) ^
|
||||
(((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]);
|
||||
|
||||
if (crc == 0x0000)
|
||||
return(1);
|
||||
else if (crc == 0xffff)
|
||||
return(2);
|
||||
else if (crc == 0x5555)
|
||||
return(4);
|
||||
else
|
||||
return(-1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -29,48 +29,13 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
//#define DEBUG_PCFICH
|
||||
extern uint8_t pcfich_b[4][32];
|
||||
|
||||
void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
uint16_t kbar = 6 * (frame_parms->Nid_cell %(2*frame_parms->N_RB_DL));
|
||||
uint16_t first_reg;
|
||||
uint16_t *pcfich_reg = frame_parms->pcfich_reg;
|
||||
|
||||
pcfich_reg[0] = kbar/6;
|
||||
first_reg = pcfich_reg[0];
|
||||
|
||||
frame_parms->pcfich_first_reg_idx=0;
|
||||
|
||||
pcfich_reg[1] = ((kbar + (frame_parms->N_RB_DL>>1)*6)%(frame_parms->N_RB_DL*12))/6;
|
||||
|
||||
if (pcfich_reg[1] < pcfich_reg[0]) {
|
||||
frame_parms->pcfich_first_reg_idx = 1;
|
||||
first_reg = pcfich_reg[1];
|
||||
}
|
||||
|
||||
pcfich_reg[2] = ((kbar + (frame_parms->N_RB_DL)*6)%(frame_parms->N_RB_DL*12))/6;
|
||||
|
||||
if (pcfich_reg[2] < first_reg) {
|
||||
frame_parms->pcfich_first_reg_idx = 2;
|
||||
first_reg = pcfich_reg[2];
|
||||
}
|
||||
|
||||
pcfich_reg[3] = ((kbar + ((3*frame_parms->N_RB_DL)>>1)*6)%(frame_parms->N_RB_DL*12))/6;
|
||||
|
||||
if (pcfich_reg[3] < first_reg) {
|
||||
frame_parms->pcfich_first_reg_idx = 3;
|
||||
first_reg = pcfich_reg[3];
|
||||
}
|
||||
|
||||
|
||||
//#ifdef DEBUG_PCFICH
|
||||
printf("pcfich_reg : %d,%d,%d,%d\n",pcfich_reg[0],pcfich_reg[1],pcfich_reg[2],pcfich_reg[3]);
|
||||
//#endif
|
||||
}
|
||||
|
||||
void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t subframe,
|
||||
@@ -96,37 +61,7 @@ void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
}
|
||||
|
||||
void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t subframe,
|
||||
int16_t *d)
|
||||
{
|
||||
|
||||
uint32_t i;
|
||||
uint8_t reset;
|
||||
uint32_t x1, x2, s=0;
|
||||
|
||||
reset = 1;
|
||||
// x1 is set in lte_gold_generic
|
||||
x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1
|
||||
|
||||
for (i=0; i<32; i++) {
|
||||
if ((i&0x1f)==0) {
|
||||
s = lte_gold_generic(&x1, &x2, reset);
|
||||
//printf("lte_gold[%d]=%x\n",i,s);
|
||||
reset = 0;
|
||||
}
|
||||
|
||||
if (((s>>(i&0x1f))&1) == 1)
|
||||
d[i]=-d[i];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t pcfich_b[4][32]= {{0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1},
|
||||
{1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0},
|
||||
{1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
|
||||
};
|
||||
|
||||
void generate_pcfich(uint8_t num_pdcch_symbols,
|
||||
int16_t amp,
|
||||
@@ -215,98 +150,3 @@ void generate_pcfich(uint8_t num_pdcch_symbols,
|
||||
}
|
||||
|
||||
|
||||
uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t subframe,
|
||||
LTE_UE_PDCCH *lte_ue_pdcch_vars,
|
||||
MIMO_mode_t mimo_mode)
|
||||
{
|
||||
|
||||
uint8_t pcfich_quad;
|
||||
uint8_t i,j;
|
||||
uint16_t reg_offset;
|
||||
|
||||
int32_t **rxdataF_comp = lte_ue_pdcch_vars->rxdataF_comp;
|
||||
int16_t pcfich_d[32],*pcfich_d_ptr;
|
||||
int32_t metric,old_metric=-16384;
|
||||
uint8_t num_pdcch_symbols=3;
|
||||
uint16_t *pcfich_reg = frame_parms->pcfich_reg;
|
||||
|
||||
// demapping
|
||||
// loop over 4 quadruplets and lookup REGs
|
||||
// m=0;
|
||||
pcfich_d_ptr = pcfich_d;
|
||||
|
||||
for (pcfich_quad=0; pcfich_quad<4; pcfich_quad++) {
|
||||
reg_offset = (pcfich_reg[pcfich_quad]*4);
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
|
||||
pcfich_d_ptr[0] = ((int16_t*)&rxdataF_comp[0][reg_offset+i])[0]; // RE component
|
||||
pcfich_d_ptr[1] = ((int16_t*)&rxdataF_comp[0][reg_offset+i])[1]; // IM component
|
||||
#ifdef DEBUG_PCFICH
|
||||
printf("rx_pcfich: quad %d, i %d, offset %d => (%d,%d) => pcfich_d_ptr[0] %d \n",pcfich_quad,i,reg_offset+i,
|
||||
((int16_t*)&rxdataF_comp[0][reg_offset+i])[0],
|
||||
((int16_t*)&rxdataF_comp[0][reg_offset+i])[1],
|
||||
pcfich_d_ptr[0]);
|
||||
#endif
|
||||
pcfich_d_ptr+=2;
|
||||
}
|
||||
|
||||
/*
|
||||
}
|
||||
else { // ALAMOUTI
|
||||
for (i=0;i<4;i+=2) {
|
||||
pcfich_d_ptr[0] = 0;
|
||||
pcfich_d_ptr[1] = 0;
|
||||
pcfich_d_ptr[2] = 0;
|
||||
pcfich_d_ptr[3] = 0;
|
||||
for (j=0;j<frame_parms->nb_antennas_rx;j++) {
|
||||
|
||||
pcfich_d_ptr[0] += (((int16_t*)&rxdataF_comp[j][reg_offset+i])[0]+
|
||||
((int16_t*)&rxdataF_comp[j+2][reg_offset+i+1])[0]); // RE component
|
||||
pcfich_d_ptr[1] += (((int16_t*)&rxdataF_comp[j][reg_offset+i])[1] -
|
||||
((int16_t*)&rxdataF_comp[j+2][reg_offset+i+1])[1]);// IM component
|
||||
|
||||
pcfich_d_ptr[2] += (((int16_t*)&rxdataF_comp[j][reg_offset+i+1])[0]-
|
||||
((int16_t*)&rxdataF_comp[j+2][reg_offset+i])[0]); // RE component
|
||||
pcfich_d_ptr[3] += (((int16_t*)&rxdataF_comp[j][reg_offset+i+1])[1] +
|
||||
((int16_t*)&rxdataF_comp[j+2][reg_offset+i])[1]);// IM component
|
||||
|
||||
|
||||
}
|
||||
|
||||
pcfich_d_ptr+=4;
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// pcfhich unscrambling
|
||||
|
||||
pcfich_unscrambling(frame_parms,subframe,pcfich_d);
|
||||
|
||||
// pcfich detection
|
||||
|
||||
for (i=0; i<3; i++) {
|
||||
metric = 0;
|
||||
|
||||
for (j=0; j<32; j++) {
|
||||
// printf("pcfich_b[%d][%d] %d => pcfich_d[%d] %d\n",i,j,pcfich_b[i][j],j,pcfich_d[j]);
|
||||
metric += (int32_t)(((pcfich_b[i][j]==0) ? (pcfich_d[j]) : (-pcfich_d[j])));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PCFICH
|
||||
printf("metric %d : %d\n",i,metric);
|
||||
#endif
|
||||
|
||||
if (metric > old_metric) {
|
||||
num_pdcch_symbols = 1+i;
|
||||
old_metric = metric;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PCFICH
|
||||
printf("[PHY] PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols);
|
||||
#endif
|
||||
return(num_pdcch_symbols);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file PHY/LTE_TRANSPORT/pcfich.c
|
||||
* \brief Top-level routines for generating and decoding the PCFICH/CFI physical/transport channel V8.6 2009-03
|
||||
* \author R. Knopp
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
|
||||
void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
uint16_t kbar = 6 * (frame_parms->Nid_cell %(2*frame_parms->N_RB_DL));
|
||||
uint16_t first_reg;
|
||||
uint16_t *pcfich_reg = frame_parms->pcfich_reg;
|
||||
|
||||
pcfich_reg[0] = kbar/6;
|
||||
first_reg = pcfich_reg[0];
|
||||
|
||||
frame_parms->pcfich_first_reg_idx=0;
|
||||
|
||||
pcfich_reg[1] = ((kbar + (frame_parms->N_RB_DL>>1)*6)%(frame_parms->N_RB_DL*12))/6;
|
||||
|
||||
if (pcfich_reg[1] < pcfich_reg[0]) {
|
||||
frame_parms->pcfich_first_reg_idx = 1;
|
||||
first_reg = pcfich_reg[1];
|
||||
}
|
||||
|
||||
pcfich_reg[2] = ((kbar + (frame_parms->N_RB_DL)*6)%(frame_parms->N_RB_DL*12))/6;
|
||||
|
||||
if (pcfich_reg[2] < first_reg) {
|
||||
frame_parms->pcfich_first_reg_idx = 2;
|
||||
first_reg = pcfich_reg[2];
|
||||
}
|
||||
|
||||
pcfich_reg[3] = ((kbar + ((3*frame_parms->N_RB_DL)>>1)*6)%(frame_parms->N_RB_DL*12))/6;
|
||||
|
||||
if (pcfich_reg[3] < first_reg) {
|
||||
frame_parms->pcfich_first_reg_idx = 3;
|
||||
first_reg = pcfich_reg[3];
|
||||
}
|
||||
|
||||
|
||||
//#ifdef DEBUG_PCFICH
|
||||
printf("pcfich_reg : %d,%d,%d,%d\n",pcfich_reg[0],pcfich_reg[1],pcfich_reg[2],pcfich_reg[3]);
|
||||
//#endif
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user