Commit 7e41fc86 authored by Rohit Gupta's avatar Rohit Gupta

Merge branch 'develop' into feature-34-test_framework

parents da4f8bfc 4248930b
This diff is collapsed.
......@@ -81,7 +81,8 @@
<compile_prog_args>--eNB -w USRP -r Rel10 --noS1 -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/rb_tool
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/CMakeFiles/nasmesh/nasmesh.ko</compile_prog_out>
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/CMakeFiles/nasmesh/nasmesh.ko
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/liboai_usrpdevif.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......@@ -122,7 +123,8 @@
<compile_prog_args>--eNB -w BLADERF -r Rel10 --noS1 -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/rb_tool
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/CMakeFiles/nasmesh/nasmesh.ko</compile_prog_out>
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/CMakeFiles/nasmesh/nasmesh.ko
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/liboai_bladerfdevif.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......@@ -138,10 +140,11 @@
<desc>Build lte_softmodem_noS1.ETHERNET.Rel10</desc>
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args>--eNB -w ETHERNET -r Rel10 --noS1 -c </compile_prog_args>
<compile_prog_args>--eNB -w None -t ETHERNET -r Rel10 --noS1 -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/rb_tool
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/CMakeFiles/nasmesh/nasmesh.ko</compile_prog_out>
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/CMakeFiles/nasmesh/nasmesh.ko
$OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/liboai_eth_transpro.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......@@ -160,7 +163,8 @@
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args>--eNB -w USRP -r Rel10 -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</compile_prog_out>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem
$OPENAIR_DIR/cmake_targets/lte_build_oai/build/liboai_usrpdevif.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......@@ -197,7 +201,8 @@
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args>--eNB -w BLADERF -r Rel10 -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</compile_prog_out>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem
$OPENAIR_DIR/cmake_targets/lte_build_oai/build/liboai_bladerfdevif.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......@@ -213,8 +218,9 @@
<desc>Build lte_softmodem.ETHERNET.Rel10</desc>
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args>--eNB -w ETHERNET -r Rel10 -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</compile_prog_out>
<compile_prog_args>--eNB -w None -t ETHERNET -r Rel10 -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem
$OPENAIR_DIR/cmake_targets/lte_build_oai/build/liboai_eth_transpro.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......@@ -261,11 +267,13 @@
<testCase id="010140" >
<class>compilation</class>
<desc>Build RRH Gateway</desc>
<desc>Build RRH Gateway for USRP(RF) + Ethernet (Transport)</desc>
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args>--RRH -w USRP -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/rrh_gw/build/rrh_gw</compile_prog_out>
<compile_prog_args>--RRH -w USRP -t ETHERNET -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/rrh_gw/build/rrh_gw
$OPENAIR_DIR/cmake_targets/rrh_gw/build/liboai_usrpdevif.so
$OPENAIR_DIR/cmake_targets/rrh_gw/build/liboai_eth_transpro.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......@@ -278,14 +286,16 @@
<testCase id="010141" >
<class>compilation</class>
<desc>Build RRH Gateway</desc>
<desc>Build RRH Gateway for EXMIMO(RF) + Ethernet (Transport)</desc>
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args>--RRH -w EXMIMO -c </compile_prog_args>
<compile_prog_args>--RRH -w EXMIMO -t ETHNERNET -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/rrh_gw/build/rrh_gw
$OPENAIR_DIR/cmake_targets/rrh_gw/build/CMakeFiles/openair_rf/openair_rf.ko
$OPENAIR_DIR/cmake_targets/rrh_gw/build/updatefw
$OPENAIR_DIR/cmake_targets/rrh_gw/build/oarf_config_exmimo.oct</compile_prog_out>
$OPENAIR_DIR/cmake_targets/rrh_gw/build/oarf_config_exmimo.oct
$OPENAIR_DIR/cmake_targets/rrh_gw/build/liboai_exmimodevif.so
$OPENAIR_DIR/cmake_targets/rrh_gw/build/liboai_eth_transpro.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......@@ -301,8 +311,10 @@
<desc>Build RRH Gateway</desc>
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args>--RRH -w BLADERF -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/rrh_gw/build/rrh_gw</compile_prog_out>
<compile_prog_args>--RRH -w BLADERF -t ETHERNET -c </compile_prog_args>
<compile_prog_out>$OPENAIR_DIR/cmake_targets/rrh_gw/build/rrh_gw
$OPENAIR_DIR/cmake_targets/rrh_gw/build/liboai_bladerfdevif.so
$OPENAIR_DIR/cmake_targets/rrh_gw/build/liboai_eth_transpro.so</compile_prog_out>
<pre_exec></pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec></main_exec>
......
......@@ -49,6 +49,7 @@ LOWLATENCY_FLAG_USER="False"
FORCE_LOWLATENCY_FLAG_USER=""
REL="Rel10"
HW="EXMIMO"
TP="None"
NOS1=0
EPC=0
VERBOSE_COMPILE=0
......@@ -90,10 +91,13 @@ Options
default is Rel10,
Rel8 limits the implementation to 3GPP Release 8 version
-w | --hardware
EXMIMO (Default), USRP, BLADERF, ETHERNET, None
EXMIMO (Default), USRP, BLADERF, None
Adds this RF board support (in external packages installation and in compilation)
-t | --transport protocol
ETHERNET , None
Adds this trasport protocol support in compilation
--oaisim
Makes the oaisim simulator. Hardware will be defaulted to "NONE".
Makes the oaisim simulator. Hardware will be defaulted to "None".
--phy_simulators
Makes the unitary tests Layer 1 simulators
--core_simulators
......@@ -170,20 +174,32 @@ function main() {
shift;;
-r | --3gpp-release)
REL=$2
echo_info "setting release to: $REL"
echo_info "Setting release to: $REL"
shift 2;;
-w | --hardware)
HW="$2" #"${i#*=}"
# Use OAI_USRP as the key word USRP is used inside UHD driver
if [ "$HW" == "USRP" ] ; then
HW="OAI_USRP"
fi
if [ "$HW" == "BLADERF" ] ; then
HW="OAI_BLADERF"
fi
echo_info "setting hardware to: $HW"
# Use OAI_USRP as the key word USRP is used inside UHD driver
if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "None" -a "$HW" != "EXMIMO" ] ; then
echo_fatal "Unknown HW type $HW will exit..."
else
if [ "$HW" == "USRP" ] ; then
HW="OAI_USRP"
fi
if [ "$HW" == "BLADERF" ] ; then
HW="OAI_BLADERF"
fi
echo_info "Setting hardware to: $HW"
fi
shift 2;;
--oaisim)
-t | --transport_protocol)
TP="$2" #"${i#*=}"
if [ "$TP" != "ETHERNET" -a "$TP" != "None" ] ; then
echo_fatal "Unknown TP type $TP will exit..."
else
echo_info "Setting transport protocol to: $TP"
fi
shift 2;;
--oaisim)
oaisim=1
echo_info "Will compile oaisim and drivers nasmesh, ..."
shift;;
......@@ -205,7 +221,7 @@ function main() {
echo_info "executing test cases only in group: $TEST_CASE_GROUP"
shift 2;;
-V | --vcd)
echo_info "setting gtk-wave output"
echo_info "Setting gtk-wave output"
VCD_TIMING=1
EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
shift;;
......@@ -228,7 +244,7 @@ function main() {
shift;;
--cflags_processor)
CFLAGS_PROCESSOR_USER=$2
echo_info "setting CPU FLAGS from USER to: $CFLAGS_PROCESSOR_USER"
echo_info "Setting CPU FLAGS from USER to: $CFLAGS_PROCESSOR_USER"
shift 2;;
--disable-deadline)
FORCE_LOWLATENCY_FLAG_USER="False"
......@@ -248,6 +264,35 @@ function main() {
break;;
esac
done
#########################################################
# check validity of HW and TP parameters for RRH and eNB
#########################################################
# to be discussed
if [ "$eNB" = "1" ] ; then
if [ "$HW" = "None" -a "$TP" = "None" ] ; then
echo_fatal "Define a local radio head (e.g. -w EXMIMO) or a transport protocol (e.g. -t ETHERNET) to communicate with a remote radio head!"
fi
if [ "$HW" != "None" -a "$TP" != "None" ] ; then
echo_fatal "Currently eNB can not support simultaniously local and remote radio heads!!"
fi
if [ "$HW" = "None" ] ; then
echo_info "No radio head has been selected (HW set to $HW)"
fi
if [ "$TP" = "None" ] ; then
echo_info "No transport protocol has been selected (TP set to $TP)"
fi
fi
if [ "$RRH" = "1" ] ; then
if [ "$TP" = "None" ] ; then
echo_fatal "A transport protocol (e.g. -t ETHERNET) must be defined!"
fi
if [ "$HW" = "None" ] ; then
echo_info "No radio head has been selected (HW set to $HW)"
fi
fi
#Now we set flags to enable deadline scheduler settings
#By default: USRP: disable,
......@@ -274,6 +319,7 @@ function main() {
echo_info "Flags for Deadline scheduler: $LOWLATENCY_FLAG_USER"
############################################
# setting and printing OAI envs, we should check here
############################################
......@@ -312,7 +358,7 @@ function main() {
check_install_usrp_uhd_driver
fi
if [ "$HW" == "OAI_BLADERF" ] ; then
echo_info "installing packages for BALDERF support"
echo_info "installing packages for BLADERF support"
check_install_bladerf_driver
fi
fi
......@@ -323,9 +369,11 @@ function main() {
fi
if [ "$oaisim" = "1" ] ; then
if [ "$HW" != "ETHERNET" ] ; then
HW="NONE"
fi
#to be discussed
# there is no RF device and no transport protocol
HW="None"
TP="None"
if [ "$XFORMS" == "True" ] ; then
PRINT_STATS="True"
fi
......@@ -359,7 +407,8 @@ function main() {
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
echo "set(PACKAGE_NAME \"${lte_exec}\")" >> $cmake_file
echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file
echo "set(PACKAGE_NAME \"${lte_exec}\")" >> $cmake_file
echo "set (LOWLATENCY \"${LOWLATENCY_FLAG_USER}\" )" >>$cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$lte_build_dir/build
......@@ -565,31 +614,97 @@ function main() {
fi
# RRH compilation
##################
#####################
if [ "$RRH" = "1" ] ; then
echo_info "Compiling RRH"
if [ $HW == "ETHERNET" ] ; then
echo_info "RF frontend for RRH is not defined. This mode is used for testing (loopback)."
elif [ $HW != "EXMIMO" -a $HW != "OAI_USRP" -a $HW != "OAI_BLADERF" ] ; then
echo_fatal "Hardware not defined ($HW)"
fi
cmake_file=$DIR/rrh_gw/CMakeLists.txt
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set(ENABLE_ITTI False )" >> $cmake_file
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo 'set(PACKAGE_NAME "\"rrh_gw\"")' >> $cmake_file
echo "set(LOWLATENCY \"${LOWLATENCY_FLAG_USER}\")" >>$cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
[ "$CLEAN" = "1" ] && rm -rf $DIR/rrh_gw/build
mkdir -p $DIR/rrh_gw/build
cd $DIR/rrh_gw/build
cmake ..
compilations \
rrh_gw rrh_gw \
rrh_gw $dbin/rrh_gw
rrh_exec=rrh_gw
rrh_build_dir=rrh_gw
echo_info "Compiling $rrh_exec ..."
[ "$CLEAN" = "1" ] && rm -rf $DIR/rrh_gw/build
mkdir -p $DIR/$rrh_build_dir/build
cmake_file=$DIR/$rrh_build_dir/CMakeLists.txt
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set(ENABLE_ITTI False )" >> $cmake_file
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo "set(TRANSP_PRO \"${TP}\")" >> $cmake_file
echo 'set(PACKAGE_NAME "\"rrh_gw\"")' >> $cmake_file
echo "set (LOWLATENCY \"${LOWLATENCY_FLAG_USER}\" )" >>$cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$rrh_build_dir/build
cmake ..
compilations \
rrh_gw rrh_gw \
rrh_gw $dbin/rrh_gw
fi
# build RF device and transport protocol libraries
#####################################
if [ "$eNB" = "1" -o "$RRH" = "1" ] ; then
if [ "$eNB" = "1" ] ; then
build_dir=$lte_build_dir
else
build_dir=$rrh_build_dir
fi
# build RF device libraries (currently EXMIMO is not complied with the rest of HW targets)
if [ "$HW" != "None" ] ; then
rm -f liboai_device.so
rm -f $dbin/liboai_device.so
# link liboai_device.so with the selected RF device library
if [ "$HW" == "EXMIMO" ] ; then
#add exmimo compilation
#TODO EXMIMO library support
echo_info "liboai_device.so is linked to EXMIMO device library"
elif [ "$HW" == "OAI_USRP" ] ; then
if [ -d "/usr/include/uhd" ] ; then
compilations \
$build_dir oai_usrpdevif \
liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
fi
ln -s liboai_usrpdevif.so liboai_device.so
ln -s $dbin/liboai_usrpdevif.so.$REL $dbin/liboai_device.so
echo_info "liboai_device.so is linked to USRP device library"
elif [ "$HW" == "OAI_BLADERF" ] ; then
if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations \
$build_dir oai_bladerfdevif \
liboai_bladerfdevif.so $dbin/liboai_bladerfdevif.so.$REL
fi
ln -s liboai_bladerfdevif.so liboai_device.so
ln -s $dbin/liboai_bladerfdevif.so.$REL $dbin/liboai_device.so
echo_info "liboai_device.so is linked to BLADERF device library"
else
echo_info "liboai_device.so is not linked to any device library"
fi
fi
# build trasport protocol libraries (currently only ETHERNET is available)
if [ "$TP" != "None" ] ; then
rm -f liboai_transpro.so
rm -f $dbin/liboai_transpro.so
if [ "$TP" == "ETHERNET" ] ; then
compilations \
$build_dir oai_eth_transpro \
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
ln -s liboai_eth_transpro.so liboai_transpro.so
ln -s $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
echo_info "liboai_transpro.so is linked with ETHERNET library"
fi
fi
fi
# Auto-tests
......
......@@ -76,6 +76,13 @@
#define openair_free(y,x) free((y))
#define PAGE_SIZE 4096
//#ifdef SHRLIBDEV
//extern int rxrescale;
//#define RX_IQRESCALELEN rxrescale
//#else
//#define RX_IQRESCALELEN 15
//#endif
//! \brief Allocate \c size bytes of memory on the heap with alignment 16 and zero it afterwards.
//! If no more memory is available, this function will terminate the program with an assertion error.
static inline void* malloc16_clear( size_t size )
......
......@@ -170,6 +170,14 @@
#define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U "ENB_IPV4_ADDRESS_FOR_S1U"
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
#define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_ADDRESS "local_address"
#define ENB_CONFIG_STRING_RRH_GW_REMOTE_ADDRESS "remote_address"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_PORT "local_port"
#define ENB_CONFIG_STRING_RRH_GW_REMOTE_PORT "remote_port"
#define ENB_CONFIG_STRING_RRH_GW_ACTIVE "active"
#define ENB_CONFIG_STRING_RRH_GW_PREFERENCE "preference"
#define ENB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity"
#define ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none"
......@@ -274,6 +282,18 @@ static void enb_config_display(void)
} else {
printf( "\tMNC: \t%02"PRIu16":\n",enb_properties.properties[i]->mnc);
}
for (j=0; j< enb_properties.properties[i]->nb_rrh_gw; j++) {
if (enb_properties.properties[i]->rrh_gw_config[j].active == 1 ){
printf( "\n\tRRH GW %d config for eNB %u:\n\n", j, i);
printf( "\tinterface name : \t%s:\n",enb_properties.properties[i]->rrh_gw_if_name);
printf( "\tlocal address : \t%s:\n",enb_properties.properties[i]->rrh_gw_config[j].local_address);
printf( "\tlocal port : \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].local_port);
printf( "\tremote address : \t%s:\n",enb_properties.properties[i]->rrh_gw_config[j].remote_address);
printf( "\tremote port : \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].remote_port);
printf( "\ttransport : \t%s Ethernet:\n\n",(enb_properties.properties[i]->rrh_gw_config[j].raw == 1)? "RAW" : "UDP");
}
}
for (j=0; j< enb_properties.properties[i]->nb_cc; j++) {
printf( "\teutra band for CC %d: \t%"PRId16":\n",j,enb_properties.properties[i]->eutra_band[j]);
......@@ -455,6 +475,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
config_setting_t *setting_srb1 = NULL;
config_setting_t *setting_mme_addresses = NULL;
config_setting_t *setting_mme_address = NULL;
config_setting_t *setting_rrh_gws = NULL;
config_setting_t *setting_rrh_gw = NULL;
config_setting_t *setting_enb = NULL;
config_setting_t *setting_otg = NULL;
config_setting_t *subsetting_otg = NULL;
......@@ -462,6 +484,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
int enb_properties_index = 0;
int num_enbs = 0;
int num_mme_address = 0;
int num_rrh_gw = 0;
int num_otg_elements =0;
int num_component_carriers =0;
int i = 0;
......@@ -558,10 +581,15 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
libconfig_int my_int;
char* if_name = NULL;
char* ipv4 = NULL;
char* ipv4_remote = NULL;
char* ipv6 = NULL;
char* active = NULL;
char* preference = NULL;
libconfig_int local_port = 0;
libconfig_int remote_port = 0;
const char* active_enb[MAX_ENB];
char* enb_interface_name_for_S1U = NULL;
char* enb_ipv4_address_for_S1U = NULL;
......@@ -2136,6 +2164,63 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv6 = 1;
}
}
// RRH Config
setting_rrh_gws = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_RRH_GW_CONFIG);
if ( setting_rrh_gws != NULL) {
num_rrh_gw = config_setting_length(setting_rrh_gws);
enb_properties.properties[enb_properties_index]->nb_rrh_gw = 0;
for (j = 0; j < num_rrh_gw; j++) {
setting_rrh_gw = config_setting_get_elem(setting_rrh_gws, j);
if ( !(
config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME, (const char **)&if_name)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_ADDRESS, (const char **)&ipv4)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_REMOTE_ADDRESS , (const char **)&ipv4_remote)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_PORT, &local_port)
&& config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_REMOTE_PORT, &remote_port)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_ACTIVE, (const char **)&active)
&& config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_PREFERENCE, (const char **)&preference)
)
) {
AssertError (0, parse_errors ++,
"Failed to parse eNB configuration file %s, %u th enb %u the RRH GW address !\n",
lib_config_file_name_pP, i, j);
continue; // FIXME will prevent segfaults below, not sure what happens at function exit...
}
enb_properties.properties[enb_properties_index]->nb_rrh_gw += 1;
enb_properties.properties[enb_properties_index]->rrh_gw_if_name = strdup(if_name);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_address = strdup(ipv4);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_address = strdup(ipv4_remote);
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_port= local_port;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_port= remote_port;
if (strcmp(active, "yes") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].active = 1;
}
if (strcmp(preference, "udp") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1;
} else if (strcmp(preference, "raw") == 0) {
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1;
} else {//if (strcmp(preference, "no") == 0)
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1;
}
}
} else {
enb_properties.properties[enb_properties_index]->nb_rrh_gw = 0;
enb_properties.properties[enb_properties_index]->rrh_gw_if_name = "none";
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_address = "0.0.0.0";
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_address = "0.0.0.0";
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_port= 0;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_port= 0;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].active = 0;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 0;
enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 0;
}
// SCTP SETTING
enb_properties.properties[enb_properties_index]->sctp_out_streams = SCTP_OUT_STREAMS;
......
......@@ -78,6 +78,17 @@ typedef struct mme_ip_address_s {
char *ipv6_address;
} mme_ip_address_t;
typedef struct rrh_gw_config_s {
unsigned udp:1;
unsigned raw:1;
unsigned active:1;
char *local_address;
char *remote_address;
uint16_t local_port;
uint16_t remote_port;
} rrh_gw_config_t;
typedef struct Enb_properties_s {
/* Unique eNB_id to identify the eNB within EPC.
* For macro eNB ids this field should be 20 bits long.
......@@ -203,6 +214,13 @@ typedef struct Enb_properties_s {
char *enb_interface_name_for_S1_MME;
in_addr_t enb_ipv4_address_for_S1_MME;
/* Nb of RRH to connect to */
uint8_t nb_rrh_gw;
char *rrh_gw_if_name;
/* List of MME to connect to */
rrh_gw_config_t rrh_gw_config[4];
// otg config
/* Nb of OTG elements */
uint8_t num_otg_elements;
......
......@@ -106,6 +106,9 @@ const char* eurecomVariablesNames[] = {
"lhw_cnt_tx",
"pck_rx",
"pck_tx",
"rx_seq_num",
"rx_seq_num_prv",
"tx_seq_num",
"cnt",
"dummy_dump",
"itti_send_msg",
......
......@@ -78,6 +78,9 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_TX_LHWCNT,
VCD_SIGNAL_DUMPER_VARIABLES_RX_PCK,
VCD_SIGNAL_DUMPER_VARIABLES_TX_PCK,
VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,
VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM_PRV,
VCD_SIGNAL_DUMPER_VARIABLES_TX_SEQ_NUM,
VCD_SIGNAL_DUMPER_VARIABLES_CNT,
VCD_SIGNAL_DUMPER_VARIABLES_DUMMY_DUMP,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
......
......@@ -823,14 +823,18 @@ void calibrate_rf(openair0_device *device) {
}
int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openair0_cfg) {
int status;
int card=0;
brf_state_t *brf = (brf_state_t*)malloc(sizeof(brf_state_t));
memset(brf, 0, sizeof(brf_state_t));
/* device specific */
openair0_cfg->txlaunch_wait = 1;//manage when TX processing is triggered
openair0_cfg->txlaunch_wait_slotcount = 1; //manage when TX processing is triggered
openair0_cfg->iq_txshift = 0;// shift
openair0_cfg->iq_rxrescale = 15;//rescale iqs
// init required params
switch ((int)openair0_cfg->sample_rate) {
case 30720000:
openair0_cfg->samples_per_packet = 2048;
......@@ -857,7 +861,8 @@ int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openai
exit(-1);
break;
}
openair0_cfg->iq_txshift= 0;
openair0_cfg->iq_rxrescale = 15; /*not sure*/
openair0_cfg->rx_gain_calib_table = calib_table_fx4;
// The number of buffers to use in the underlying data stream
......@@ -1001,6 +1006,7 @@ int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openai
printf("BLADERF: Initializing openair0_device\n");
device->priv = brf;
device->Mod_id = num_devices++;
device->type = BLADERF_DEV;
device->trx_start_func = trx_brf_start;
device->trx_end_func = trx_brf_end;
device->trx_read_func = trx_brf_read;
......
......@@ -37,31 +37,136 @@
* \warning
*/
#include <stdio.h>
#include <strings.h>
#include <dlfcn.h>
#include <errno.h>
#include <string.h>
#include "common_lib.h"
int set_device(openair0_device *device) {
switch (device->type) {
case EXMIMO_DEV:
printf("[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break;
case USRP_B200_DEV:
printf("[%s] has loaded USRP B200 device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break;
case USRP_X300_DEV:
printf("[%s] has loaded USRP X300 device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break;
case BLADERF_DEV:
printf("[%s] has loaded BLADERF device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break;
case NONE_DEV:
printf("[%s] has not loaded a HW device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break;
default:
printf("[%s] invalid HW device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
return -1;
}
return 0;
}
int set_transport(openair0_device *device) {
switch (device->transp_type) {
case ETHERNET_TP:
printf("[%s] has loaded ETHERNET trasport protocol.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
return 0;
break;
case NONE_TP:
printf("[%s] has not loaded a transport protocol.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
return 0;
break;
default:
printf("[%s] invalid transport protocol.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
return -1;
break;
}
}
/* look for the interface library and load it */
int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * cfg, uint8_t flag) {
void *lib_handle;
oai_device_initfunc_t dp ;
oai_transport_initfunc_t tp ;
if (flag == BBU_LOCAL_RADIO_HEAD) {
lib_handle = dlopen(OAI_RF_LIBNAME, RTLD_LAZY);
if (!lib_handle) {
printf( "Unable to locate %s: HW device set to NONE_DEV.\n", OAI_RF_LIBNAME);
return 0;
}
dp = dlsym(lib_handle,"device_init");
if (dp != NULL ) {
dp(device,openair0_cfg);
} else {
fprintf(stderr, "%s %d:oai device intializing function not found %s\n", __FILE__, __LINE__, dlerror());
return -1;
}
} else {
lib_handle = dlopen(OAI_TP_LIBNAME, RTLD_LAZY);
if (!lib_handle) {
printf( "Unable to locate %s: transport protocol set to NONE_TP.\n", OAI_TP_LIBNAME);
return 0;
}
tp = dlsym(lib_handle,"transport_init");
if (tp != NULL ) {
tp(device,openair0_cfg,cfg);
} else {
fprintf(stderr, "%s %d:oai device intializing function not found %s\n", __FILE__, __LINE__, dlerror());
return -1;
}
}
return 0;
}
int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg) {
#ifdef ETHERNET
device->type=ETH_IF;
device->func_type = BBU_FUNC;
printf(" openair0_dev_init_eth ...\n");
return(openair0_dev_init_eth(device, openair0_cfg));
#elif EXMIMO
device->type=EXMIMO_IF;
printf("openair0_dev_init_exmimo...\n");
return(openair0_dev_init_exmimo(device, openair0_cfg));
#elif OAI_USRP
device->type=USRP_B200_IF;
printf("openair0_dev_init_usrp ...\n");
return(openair0_dev_init_usrp(device, openair0_cfg));
#elif OAI_BLADERF
device->type=BLADERF_IF;
printf(" openair0_dev_init_bladerf ...\n");
return(openair0_dev_init_bladerf(device, openair0_cfg));
#endif
int rc;
//ToDo: EXMIMO harmonization is not complete. That is the reason for this ifdef
#ifdef EXMIMO
device_init(device, openair0_cfg);
#else
rc=load_lib(device, openair0_cfg, NULL,BBU_LOCAL_RADIO_HEAD );
if ( rc >= 0) {
if ( set_device(device) < 0) {
fprintf(stderr, "%s %d:Unsupported radio head\n",__FILE__, __LINE__);
return -1;
}
}
#endif
return 0;
}
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params) {
int rc;
rc=load_lib(device, openair0_cfg, eth_params, BBU_REMOTE_RADIO_HEAD);
if ( rc >= 0) {
if ( set_transport(device) < 0) {
fprintf(stderr, "%s %d:Unsupported transport protocol\n",__FILE__, __LINE__);
return -1;
}
}
return 0;
}
......@@ -42,6 +42,15 @@
#include <stdint.h>
#include <sys/types.h>
/* name of shared library implementing the radio front end */
#define OAI_RF_LIBNAME "liboai_device.so"
/* name of shared library implementing the transport */
#define OAI_TP_LIBNAME "liboai_transpro.so"
/* flags for BBU to determine whether the attached radio head is local or remote */
#define BBU_LOCAL_RADIO_HEAD 0
#define BBU_REMOTE_RADIO_HEAD 1
typedef int64_t openair0_timestamp;
typedef volatile int64_t openair0_vtimestamp;
......@@ -65,6 +74,49 @@ typedef enum {
} duplex_mode_t;
/*!\brief RF device types
*/
typedef enum {
MIN_RF_DEV_TYPE = 0,
/*!\brief device is ExpressMIMO */
EXMIMO_DEV,
/*!\brief device is USRP B200/B210*/
USRP_B200_DEV,
/*!\brief device is USRP X300/X310*/
USRP_X300_DEV,
/*!\brief device is BLADE RF*/
BLADERF_DEV,
/*!\brief device is NONE*/
NONE_DEV,
MAX_RF_DEV_TYPE
} dev_type_t;
/*!\brief transport protocol types
*/
typedef enum {
MIN_TRANSP_TYPE = 0,
/*!\brief transport protocol ETHERNET */
ETHERNET_TP,
/*!\brief no transport protocol*/
NONE_TP,
MAX_TRANSP_TYPE
} transport_type_t;
/*!\brief openair0 device host type */
typedef enum {
MIN_HOST_TYPE = 0,
/*!\brief device functions within a BBU */
BBU_HOST,
/*!\brief device functions within a RRH */
RRH_HOST,
MAX_HOST_TYPE
}host_type_t;
/** @addtogroup _PHY_RF_INTERFACE_
* @{
*/
......@@ -90,11 +142,15 @@ typedef struct {
//! the sample rate for both transmit and receive.
double sample_rate;
//! number of samples per RX/TX packet (USRP + Ethernet)
int samples_per_packet;
unsigned int samples_per_packet;
//! delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist
int tx_scheduling_advance;
//! offset in samples between TX and RX paths
int tx_sample_advance;
//! configurable tx thread lauch delay
int txlaunch_wait; /* 1 or 0 */
//! configurable tx thread lauch delay
int txlaunch_wait_slotcount;
//! number of RX channels (=RX antennas)
int rx_num_channels;
//! number of TX channels (=TX antennas)
......@@ -125,14 +181,18 @@ typedef struct {
double tx_bw;
//! Auto calibration flag
int autocal[4];
//! RRH IP addr for Ethernet interface
char *remote_ip;
//! RRH port number for Ethernet interface
int remote_port;
//! my IP addr for Ethernet interface (eNB/BBU, UE)
char *my_ip;
//! my port number for Ethernet interface (eNB/BBU, UE)
int my_port;
//! rf devices work with x bits iqs when oai have its own iq format
//! the two following parameters are used to convert iqs
int iq_txshift;
int iq_rxrescale;
//! remote IP/MAC addr for Ethernet interface
char *remote_addr;
//! remote port number for Ethernet interface
unsigned int remote_port;
//! local IP/MAC addr for Ethernet interface (eNB/BBU, UE)
char *my_addr;
//! local port number for Ethernet interface (eNB/BBU, UE)
unsigned int my_port;
} openair0_config_t;
......@@ -143,59 +203,38 @@ typedef struct {
int chain;
} openair0_rf_map;
typedef struct {
char *remote_addr;
//! remote port number for Ethernet interface
unsigned int remote_port;
//! local IP/MAC addr for Ethernet interface (eNB/BBU, UE)
char *my_addr;
//! local port number for Ethernet interface (eNB/BBU, UE)
unsigned int my_port;
//! local port number for Ethernet interface (eNB/BBU, UE)
char *local_if_name;
//! local port number for Ethernet interface (eNB/BBU, UE)
uint8_t transp_preference;
} eth_params_t;
/*!\brief interface types that apply to modules (RRH_BBU/RRH_UE) created in RRH (rrh_gw.c)
and are defined with respect to the RF device that is present in RRH
-RRH_BBU modules have two devices, one is by default ETHERNET (will have ETH_IF) and the other one is a
RF device (EXMIMO,USRP,BLADERF) or no device (NONE_IF).
-RRH_UE modules have two devices one is by default ETHERNET (will have ETH_IF)
and the other one by default not present so it will have NONE_IF
*/
typedef enum {
MIN_DEV_TYPE = 0,
/*!\brief device is ETH */
ETH_IF,
/*!\brief device is ExpressMIMO */
EXMIMO_IF,
/*!\brief device is USRP B200/B210*/
USRP_B200_IF,
/*!\brief device is USRP X300/X310*/
USRP_X300_IF,
/*!\brief device is BLADE RF*/
BLADERF_IF,
/*!\brief device is NONE*/
NONE_IF,
MAX_DEV_TYPE
} dev_type_t;
/*!\brief openair0 device host type */
typedef enum {
MIN_FUNC_TYPE = 0,
/*!\brief device functions within a BBU */
BBU_FUNC,
/*!\brief device functions within a RRH */
RRH_FUNC,
MAX_FUNC_TYPE
}func_type_t;
struct openair0_device_t {
/* Module ID of this device */
/*!brief Module ID of this device */
int Mod_id;
/* Type of this device */
/*!brief Type of this device */
dev_type_t type;
/* Type of the device's host (BBU/RRH) */
func_type_t func_type;
/*!brief Transport protocol type that the device suppports (in case I/Q samples need to be transported) */
transport_type_t transp_type;
/*!brief Type of the device's host (BBU/RRH) */
host_type_t host_type;
/* RF frontend parameters set by application */
/* !brief RF frontend parameters set by application */
openair0_config_t *openair0_cfg;
/* Can be used by driver to hold internal structure*/
/*!brief Can be used by driver to hold internal structure*/
void *priv;
/* Functions API, which are called by the application*/
......@@ -276,27 +315,27 @@ struct openair0_device_t {
};
/* type of device init function, implemented in shared lib */
typedef int(*oai_device_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg);
/* type of transport init function, implemented in shared lib */
typedef int(*oai_transport_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params);
#ifdef __cplusplus
extern "C"
{
#endif
/*! \brief Initialize Openair RF target. It returns 0 if OK */
int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg);
/*! \brief Initialize openair RF target. It returns 0 if OK */
int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg);
/*! \brief Initialize transport protocol . It returns 0 if OK */
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params);
//USRP
/*! \brief Get the current timestamp of USRP */
openair0_timestamp get_usrp_time(openair0_device *device);
/*! \brief Set the RX frequency of USRP RF TARGET */
int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg);
//extern
/*! \brief Initialize Openair ETHERNET target. It returns 0 if OK */
int openair0_dev_init_eth(openair0_device *device, openair0_config_t *openair0_cfg);
int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openair0_cfg);
int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_cfg);
int openair0_dev_init_exmimo(openair0_device *device, openair0_config_t *openair0_cfg);
/*@}*/
#ifdef __cplusplus
......
This diff is collapsed.
This diff is collapsed.
......@@ -36,6 +36,8 @@
* \note
* \warning
*/
#ifndef ETHERNET_LIB_H
#define ETHERNET_LIB_H
#include <arpa/inet.h>
#include <linux/if_packet.h>
......@@ -47,71 +49,90 @@
#include <net/if.h>
#include <netinet/ether.h>
#define MAX_INST 4
#define DEFAULT_IF "lo"
#define BUF_SIZ 8960 /*Jumbo frame size*/
#define MAX_INST 4
#define DEFAULT_IF "lo"
typedef struct {
#define ETH_RAW_MODE 1
#define ETH_UDP_MODE 0
// opaque eth data struct
//struct eth_if *dev;
// An empty ("") or NULL device identifier will result in the first encountered device being opened (using the first discovered backend)
#define TX_FLAG 1
#define RX_FLAG 0
int sockfd[MAX_INST];
struct sockaddr_in dest_addr[MAX_INST];
#define MAX_PACKET_SEQ_NUM(spp,spf) (spf/spp)
#define MAC_HEADER_SIZE_BYTES (sizeof(struct ether_header))
#define APP_HEADER_SIZE_BYTES (sizeof(int32_t) + sizeof(openair0_timestamp))
#define PAYLOAD_SIZE_BYTES(nsamps) (nsamps<<2)
#define UDP_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps))
#define RAW_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps))
unsigned int buffer_size;
unsigned int timeout_ns;
//struct eth_metadata meta_rx;
//struct eth_metadata meta_tx;
unsigned int sample_rate;
// time offset between transmiter timestamp and receiver timestamp;
/*!\brief opaque ethernet data structure */
typedef struct {
/*!\brief socket file desc */
int sockfd[MAX_INST];
/*!\brief interface name */
char *if_name[MAX_INST];
/*!\brief buffer size */
unsigned int buffer_size;
/*!\brief timeout ms */
unsigned int rx_timeout_ms;
/*!\brief timeout ms */
unsigned int tx_timeout_ms;
/*!\brief runtime flags */
uint32_t flags;
/*!\ time offset between transmiter timestamp and receiver timestamp */
double tdiff;
// use brf_time_offset to get this value
int tx_forward_nsamps; //166 for 20Mhz
/*!\ calibration */
int tx_forward_nsamps;
// --------------------------------
// Debug and output control
// --------------------------------
/*!\brief number of I/Q samples to be printed */
int iqdumpcnt;
/*!\brief number of underflows in interface */
int num_underflows;
/*!\brief number of overflows in interface */
int num_overflows;
/*!\brief number of concesutive errors in interface */
int num_seq_errors;
/*!\brief number of errors in interface's receiver */
int num_rx_errors;
/*!\brief umber of errors in interface's transmitter */
int num_tx_errors;
uint64_t tx_actual_nsamps; // actual number of samples transmitted
/*!\brief current TX timestamp */
openair0_timestamp tx_current_ts;
/*!\brief socket file desc */
openair0_timestamp rx_current_ts;
/*!\brief actual number of samples transmitted */
uint64_t tx_actual_nsamps;
/*!\brief actual number of samples received */
uint64_t rx_actual_nsamps;
uint64_t tx_nsamps; // number of planned samples
/*!\brief number of samples to be transmitted */
uint64_t tx_nsamps;
/*!\brief number of samples to be received */
uint64_t rx_nsamps;
uint64_t tx_count; // number pf packets
/*!\brief number of packets transmitted */
uint64_t tx_count;
/*!\brief number of packets received */
uint64_t rx_count;
//openair0_timestamp rx_timestamp;
} eth_state_t;
#define ETH_META_STATUS_OVERRUN (1 << 0)
#define ETH_META_STATUS_UNDERRUN (1 << 1)
struct eth_meta_data{
uint64_t timestamp;
uint32_t flags;
uint32_t status;
unsigned int actual_count;
};
/*!\brief packet header */
typedef struct {
/*!\brief packet sequence number max value=packets per frame*/
uint16_t seq_num ;
/*!\brief antenna port used to resynchronize */
uint16_t antenna_id;
/*!\brief packet's timestamp */
openair0_timestamp timestamp;
/*!\brief variable declared for alignment purposes (sample size=32 bit) */
int16_t not_used;
/*!\brief antenna port used to resynchronize */
int16_t antenna_id;
} header_t;
/*!\brief different options for ethernet tuning in socket and driver level */
......@@ -138,9 +159,37 @@ typedef enum {
MAX_OPT
} eth_opt_t;
/*
#define SND_BUF_SIZE 1
#define RCV_BUF_SIZE 1<<1
#define SND_TIMEOUT 1<<2
#define RCV_TIMEOUT 1<<3
#define MTU_SIZE 1<<4
#define TX_Q_LEN 1<<5
#define RING_PAR 1<<5
#define COALESCE_PAR 1<<6
#define PAUSE_PAR 1<<7
*/
/*!\brief I/Q samples */
typedef struct {
/*!\brief phase */
short i;
/*!\brief quadrature */
short q;
} iqoai_t ;
/*! \fn int ethernet_tune (openair0_device *device, eth_opt_t option)
void dump_packet(char *title, unsigned char* pkt, int bytes, unsigned int tx_rx_flag);
unsigned short calc_csum (unsigned short *buf, int nwords);
void dump_dev(openair0_device *device);
void inline dump_buff(openair0_device *device, char *buff,unsigned int tx_rx_flag,int nsamps);
void inline dump_rxcounters(openair0_device *device);
void inline dump_txcounters(openair0_device *device);
void dump_iqs(char * buff, int iq_cnt);
/*! \fn int ethernet_tune (openair0_device *device, unsigned int option, int value);
* \brief this function allows you to configure certain ethernet parameters in socket or device level
* \param[in] openair0 device which bears the socket
* \param[in] name of parameter to configure
......@@ -148,6 +197,37 @@ typedef enum {
* \note
* @ingroup _oai
*/
int ethernet_tune (openair0_device *device, eth_opt_t option);
int ethernet_write_data(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc) ;
int ethernet_read_data(openair0_device *device,openair0_timestamp *timestamp,void **buff, int nsamps,int cc);
int ethernet_tune(openair0_device *device, unsigned int option, int value);
/*! \fn int eth_socket_init_udp(openair0_device *device)
* \brief initialization of UDP Socket to communicate with one destination
* \param[in] *device openair device for which the socket will be created
* \param[out]
* \return 0 on success, otherwise -1
* \note
* @ingroup _oai
*/
int eth_socket_init_udp(openair0_device *device);
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
int eth_get_dev_conf_udp(openair0_device *device);
/*! \fn static int eth_set_dev_conf_udp(openair0_device *device)
* \brief
* \param[in] *device openair device
* \param[out]
* \return 0 on success, otherwise -1
* \note
* @ingroup _oai
*/
int eth_set_dev_conf_udp(openair0_device *device);
int eth_socket_init_raw(openair0_device *device);
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
int eth_get_dev_conf_raw(openair0_device *device);
int eth_set_dev_conf_raw(openair0_device *device);
#endif
......@@ -247,7 +247,7 @@ int openair0_stop_without_reset(int card)
#define MY_RF_MODE (RXEN + TXEN + TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM + DMAMODE_RX + DMAMODE_TX)
#define RF_MODE_BASE (LNA1ON + RFBBNORM)
int openair0_dev_init_exmimo(openair0_device *device, openair0_config_t *openair0_cfg) {
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
// Initialize card
// exmimo_config_t *p_exmimo_config;
......@@ -287,6 +287,8 @@ int openair0_dev_init_exmimo(openair0_device *device, openair0_config_t *openair
return(-1);
}
device->type = EXMIMO_DEV;
return(0);
}
......@@ -323,6 +325,12 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
else
p_exmimo_config->framing.multicard_syncmode=SYNCMODE_SLAVE;
/* device specific */
openair0_cfg[card].txlaunch_wait = 1;//manage when TX processing is triggered
openair0_cfg[card].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered
openair0_cfg[card].iq_txshift = 4;//shift
openair0_cfg[card].iq_rxrescale = 15;//rescale iqs
if (openair0_cfg[card].sample_rate==30.72e6) {
resampling_factor = 0;
rx_filter = RXLPF10;
......
......@@ -172,7 +172,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif
if (device->type == USRP_B200_IF) {
if (device->type == USRP_B200_DEV) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs;
......@@ -198,7 +198,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif
}
}
} else if (device->type == USRP_X300_IF) {
} else if (device->type == USRP_X300_DEV) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs;
......@@ -386,13 +386,14 @@ int trx_usrp_reset_stats(openair0_device* device) {
}
int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_cfg)
{
uhd::set_thread_priority_safe(1.0);
usrp_state_t *s = (usrp_state_t*)malloc(sizeof(usrp_state_t));
memset(s, 0, sizeof(usrp_state_t));
// Initialize USRP device
extern "C" {
int device_init(openair0_device* device, openair0_config_t *openair0_cfg) {
uhd::set_thread_priority_safe(1.0);
usrp_state_t *s = (usrp_state_t*)malloc(sizeof(usrp_state_t));
memset(s, 0, sizeof(usrp_state_t));
// Initialize USRP device
std::string args = "type=b200";
......@@ -436,14 +437,14 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
s->usrp->set_clock_source("internal");
//Setting device type to USRP X300/X310
device->type=USRP_X300_IF;
device->type=USRP_X300_DEV;
// this is not working yet, master clock has to be set via constructor
// set master clock rate and sample rate for tx & rx for streaming
//s->usrp->set_master_clock_rate(usrp_master_clock);
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
// from usrp_time_offset
......@@ -487,13 +488,13 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
// s->usrp->set_rx_subdev_spec(rx_subdev);
// s->usrp->set_tx_subdev_spec(tx_subdev);
// do not explicitly set the clock to "internal", because this will disable the gpsdo
// // lock mboard clocks
// s->usrp->set_clock_source("internal");
// do not explicitly set the clock to "internal", because this will disable the gpsdo
// // lock mboard clocks
// s->usrp->set_clock_source("internal");
// set master clock rate and sample rate for tx & rx for streaming
device->type = USRP_B200_IF;
device->type = USRP_B200_DEV;
if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
......@@ -553,6 +554,12 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
}
}
/* device specific */
openair0_cfg[0].txlaunch_wait = 1;//manage when TX processing is triggered
openair0_cfg[0].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered
openair0_cfg[0].iq_txshift = 4;//shift
openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
for(i=0;i<s->usrp->get_rx_num_channels();i++) {
if (i<openair0_cfg[0].rx_num_channels) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
......@@ -606,10 +613,7 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
s->usrp->set_time_now(uhd::time_spec_t(0.0));
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
if (i<openair0_cfg[0].rx_num_channels) {
......@@ -657,4 +661,5 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
if(is_equal(s->sample_rate, (double)7.68e6))
s->tx_forward_nsamps = 50;
return 0;
}
}
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "92";
////////// Physical parameters:
component_carriers = (
{
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2660000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 125;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -29;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -90;
pusch_alpha = "AL1";
pucch_p0_Nominal = -96;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -108;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.170";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
rrh_gw_config = (
{
local_if_name = "eth0";
remote_address = "169.254.8.28";
#remote_address = "127.0.0.1";
#remote_address = "74:d4:35:cc:88:45";
local_address = "169.254.7.91";
#local_address = "127.0.0.1";
#local_address = "d4:be:d9:22:0a:ac";
#for raw option local port must be the same to remote
local_port = 50001;
remote_port = 50000;
active = "yes";
preference = "udp";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.242/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.242/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
guepe@guepe.25164:1451994252
\ No newline at end of file
......@@ -148,7 +148,7 @@ void *rrh_proc_UE_thread(void * arg) {
unsigned int samples_per_frame=0;
rrh_module_t *dev=(rrh_module_t *)arg;
samples_per_frame= dev->eth_dev.openair0_cfg.samples_per_frame;
samples_per_frame= dev->eth_dev.openair0_cfg->samples_per_frame;
AssertFatal(samples_per_frame <=0, "invalide samples_per_frame !%u\n",samples_per_frame);
time_req.tv_sec = 0;
......@@ -260,7 +260,7 @@ void *rrh_UE_thread(void *arg) {
void *tmp;
unsigned int samples_per_frame=0;
samples_per_frame= dev->eth_dev.openair0_cfg.samples_per_frame;
samples_per_frame= dev->eth_dev.openair0_cfg->samples_per_frame;
time_req_1us.tv_sec = 0;
time_req_1us.tv_nsec = 1000;
......@@ -269,26 +269,26 @@ void *rrh_UE_thread(void *arg) {
cmd=dev->eth_dev.trx_start_func(&dev->eth_dev);
/* allocate memory for TX/RX buffers */
rx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg.rx_num_channels*sizeof(int32_t*));
tx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg.tx_num_channels*sizeof(int32_t*));
rx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*));
tx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*));
for (i=0; i<dev->eth_dev.openair0_cfg.rx_num_channels; i++) {
for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4));
memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4));
rx_buffer_UE[i]=(tmp+4*sizeof(int32_t));
}
for (i=0; i<dev->eth_dev.openair0_cfg.tx_num_channels; i++) {
for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4));
memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4));
tx_buffer_UE[i]=(tmp+4*sizeof(int32_t));
}
printf("Client %s:%d is connected (DL_RB=%d) rt=%d|%d. \n" , dev->eth_dev.openair0_cfg.remote_ip,
dev->eth_dev.openair0_cfg.remote_port,
dev->eth_dev.openair0_cfg.num_rb_dl,
dev->eth_dev.openair0_cfg.rx_num_channels,
dev->eth_dev.openair0_cfg.tx_num_channels);
printf("Client %s:%d is connected (DL_RB=%d) rt=%d|%d. \n" , dev->eth_dev.openair0_cfg->remote_addr,
dev->eth_dev.openair0_cfg->remote_port,
dev->eth_dev.openair0_cfg->num_rb_dl,
dev->eth_dev.openair0_cfg->rx_num_channels,
dev->eth_dev.openair0_cfg->tx_num_channels);
if (cmd==START_CMD) {
......@@ -348,8 +348,8 @@ void *rrh_UE_rx_thread(void *arg) {
openair0_timestamp temp, last_hw_counter=0;
antenna_index = 0;
nsamps = dev->eth_dev.openair0_cfg.samples_per_packet;
samples_per_frame = dev->eth_dev.openair0_cfg.samples_per_frame;
nsamps = dev->eth_dev.openair0_cfg->samples_per_packet;
samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
while (rrh_exit == 0) {
if (!UE_rx_started) {
......@@ -492,8 +492,8 @@ void *rrh_UE_tx_thread(void *arg) {
unsigned int samples_per_frame=0;
antenna_index = 0;
nsamps = dev->eth_dev.openair0_cfg.samples_per_packet;
samples_per_frame = dev->eth_dev.openair0_cfg.samples_per_frame;
nsamps = dev->eth_dev.openair0_cfg->samples_per_packet;
samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
while (rrh_exit == 0) {
......
This diff is collapsed.
This diff is collapsed.
[*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Thu Sep 17 14:23:43 2015
[*] Fri Jan 29 16:34:46 2016
[*]
[dumpfile] "/tmp/openair_dump_rrh.vcd"
[dumpfile_mtime] "Thu Sep 17 14:21:43 2015"
[dumpfile_size] 636509125
[savefile] "/home/guepe/openair4G/targets/RT/USER/rrh.gtkw"
[timestart] 17746655400
[size] 1855 1056
[pos] -1 -1
*-15.826077 17746846200 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[dumpfile_mtime] "Fri Jan 29 16:20:55 2016"
[dumpfile_size] 224259458
[savefile] "/home/guepe/openairinterface5g_rrh/openairinterface5g/targets/RT/USER/rrh.gtkw"
[timestart] 31315875900
[size] 1004 1028
[pos] 926 -1
*-17.429794 31316090054 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[sst_width] 224
[signals_width] 230
[signals_width] 261
[sst_expanded] 1
[sst_vpaned_height] 287
[sst_vpaned_height] 278
@24
[color] 1
variables.hw_frame_rx[63:0]
......@@ -23,7 +23,10 @@ variables.hw_subframe_rx[63:0]
[color] 1
functions.eNB_rx
functions.eNB_rx_sleep
functions.trx_write_rf
[color] 3
functions.trx_read_rf
[color] 7
functions.trx_write
@c00024
variables.rxcnt[63:0]
@28
......@@ -95,24 +98,97 @@ variables.rxcnt[63:0]
-group_end
@24
variables.pck_rx[63:0]
variables.rx_ts[63:0]
@c00024
variables.tx_seq_num[63:0]
@28
(0)variables.tx_seq_num[63:0]
(1)variables.tx_seq_num[63:0]
(2)variables.tx_seq_num[63:0]
(3)variables.tx_seq_num[63:0]
(4)variables.tx_seq_num[63:0]
(5)variables.tx_seq_num[63:0]
(6)variables.tx_seq_num[63:0]
(7)variables.tx_seq_num[63:0]
(8)variables.tx_seq_num[63:0]
(9)variables.tx_seq_num[63:0]
(10)variables.tx_seq_num[63:0]
(11)variables.tx_seq_num[63:0]
(12)variables.tx_seq_num[63:0]
(13)variables.tx_seq_num[63:0]
(14)variables.tx_seq_num[63:0]
(15)variables.tx_seq_num[63:0]
(16)variables.tx_seq_num[63:0]
(17)variables.tx_seq_num[63:0]
(18)variables.tx_seq_num[63:0]
(19)variables.tx_seq_num[63:0]
(20)variables.tx_seq_num[63:0]
(21)variables.tx_seq_num[63:0]
(22)variables.tx_seq_num[63:0]
(23)variables.tx_seq_num[63:0]
(24)variables.tx_seq_num[63:0]
(25)variables.tx_seq_num[63:0]
(26)variables.tx_seq_num[63:0]
(27)variables.tx_seq_num[63:0]
(28)variables.tx_seq_num[63:0]
(29)variables.tx_seq_num[63:0]
(30)variables.tx_seq_num[63:0]
(31)variables.tx_seq_num[63:0]
(32)variables.tx_seq_num[63:0]
(33)variables.tx_seq_num[63:0]
(34)variables.tx_seq_num[63:0]
(35)variables.tx_seq_num[63:0]
(36)variables.tx_seq_num[63:0]
(37)variables.tx_seq_num[63:0]
(38)variables.tx_seq_num[63:0]
(39)variables.tx_seq_num[63:0]
(40)variables.tx_seq_num[63:0]
(41)variables.tx_seq_num[63:0]
(42)variables.tx_seq_num[63:0]
(43)variables.tx_seq_num[63:0]
(44)variables.tx_seq_num[63:0]
(45)variables.tx_seq_num[63:0]
(46)variables.tx_seq_num[63:0]
(47)variables.tx_seq_num[63:0]
(48)variables.tx_seq_num[63:0]
(49)variables.tx_seq_num[63:0]
(50)variables.tx_seq_num[63:0]
(51)variables.tx_seq_num[63:0]
(52)variables.tx_seq_num[63:0]
(53)variables.tx_seq_num[63:0]
(54)variables.tx_seq_num[63:0]
(55)variables.tx_seq_num[63:0]
(56)variables.tx_seq_num[63:0]
(57)variables.tx_seq_num[63:0]
(58)variables.tx_seq_num[63:0]
(59)variables.tx_seq_num[63:0]
(60)variables.tx_seq_num[63:0]
(61)variables.tx_seq_num[63:0]
(62)variables.tx_seq_num[63:0]
(63)variables.tx_seq_num[63:0]
@1401200
-group_end
@24
variables.hw_frame[63:0]
variables.hw_subframe[63:0]
@28
[color] 1
functions.eNB_tx
functions.eNB_tx_sleep
functions.trx_read_rf
[color] 7
functions.trx_write
[color] 7
functions.trx_read
[color] 3
functions.trx_write_rf
@24
variables.txcnt[63:0]
variables.rx_ts[63:0]
variables.pck_tx[63:0]
variables.tx_ts[63:0]
@25
variables.rx_seq_num_prv[63:0]
@24
variables.rx_seq_num[63:0]
variables.hw_cnt_rx[63:0]
variables.lhw_cnt_rx[63:0]
@25
[color] 3
variables.cnt[63:0]
[pattern_trace] 1
......
......@@ -51,9 +51,9 @@
#include <time.h>
#include "common_lib.h"
#include "rrh_gw.h" // change to rrh_new.h, put externs in rrh_extern.h
#include "rrh_gw.h"
#include "rt_wrapper.h"
#include "rrh_gw_externs.h" // change to rrh_new.h, put externs in rrh_extern.h
#include "rrh_gw_externs.h"
#include "log_if.h"
......@@ -71,8 +71,9 @@
*****************************************************************************************/
char rrh_ip[20] = "192.168.12.242"; // there is code to detect the my ip address
/* local IP/MAC address is detected*/
char rrh_ip[20] = "0.0.0.0";
unsigned char rrh_mac[6] = "0:0:0:0:0:0";
int rrh_port = 50000; // has to be an option
/* log */
......@@ -86,7 +87,7 @@ int16_t ue_log_level = LOG_INFO;
int16_t ue_log_verbosity = LOG_MED;
/* flags definitions */
/* flag definitions */
uint8_t eNB_flag=0;
uint8_t UE_flag=0;
uint8_t EXMIMO_flag=0;
......@@ -102,10 +103,8 @@ uint8_t measurements_flag=0;
- default ethernet interface is local */
uint8_t num_eNB_mod=0;
uint8_t num_UE_mod=0;
uint8_t num_EXMIMO_mod=0;
uint8_t num_USRP_mod=0;
uint8_t hardware_target=NONE_IF;
char* if_name="lo";
char* if_name="lo";
uint8_t eth_mode=ETH_UDP_MODE;
rrh_module_t *enb_array;
rrh_module_t *ue_array;
......@@ -128,14 +127,14 @@ static void print_help(void);
*/
static rrh_module_t new_module(unsigned int id);
/*!\fn static int get_ip_address(char* if_name)
/*!\fn static int get_address(char* if_name, uint8_t flag);
* \brief retrieves IP address from the specified network interface
* \param[in] name of network interface
* \return 0
* \note
* @ingroup _oai
*/
static int get_ip_address(char* if_name);
static int get_address(char* if_name, uint8_t flag);
......@@ -192,48 +191,53 @@ static rrh_module_t new_module (unsigned int id) {
rrh_mod.measurements=measurements_flag;
/* each module is associated with an ethernet device */
rrh_mod.eth_dev.type=ETH_IF;
rrh_mod.eth_dev.type=NONE_DEV;
rrh_mod.eth_dev.transp_type=NONE_TP;
/* ethernet device is functioning within RRH */
rrh_mod.eth_dev.func_type=RRH_FUNC;
/* specify IP address */
get_ip_address(if_name);
openair0_cfg.my_ip=&rrh_ip[0];
openair0_cfg.my_port=rrh_port;
rrh_mod.eth_dev.host_type=RRH_HOST;
/* */
rrh_mod.eth_dev.openair0_cfg = (openair0_config_t*)malloc(sizeof(openair0_config_t));
memset(rrh_mod.eth_dev.openair0_cfg,0,sizeof(openair0_config_t));
/* get IP and MAC address */
get_address(if_name,eth_mode);
if(eth_mode==ETH_UDP_MODE) {
openair0_cfg.my_addr = &rrh_ip[0];
openair0_cfg.my_port = rrh_port;
LOG_I(RRH,"UDP mode selected for ethernet.\n");
} else if (eth_mode==ETH_RAW_MODE) {
openair0_cfg.my_addr = &rrh_mac[0];
openair0_cfg.my_port = rrh_port;
LOG_I(RRH,"RAW mode selected for ethernet.\n");
}
/* */
eth_params_t *eth_params = (eth_params_t*)malloc(sizeof(eth_params_t));
memset(eth_params, 0, sizeof(eth_params_t));
eth_params->local_if_name = if_name;
eth_params->transp_preference = eth_mode;
/* ethernet device initialization */
if (openair0_dev_init_eth(&rrh_mod.eth_dev, &openair0_cfg)<0){
if (openair0_transport_load(&rrh_mod.eth_dev, &openair0_cfg,eth_params)<0) {
LOG_E(RRH,"Exiting, cannot initialize ethernet interface.\n");
exit(-1);
}
/* allocate space and specify associated RF device */
openair0_device *oai_dv = (openair0_device *)malloc(sizeof(openair0_device));
memset(oai_dv,0, sizeof(openair0_device));
memset(oai_dv,0,sizeof(openair0_device));
#ifdef EXMIMO
rrh_mod.devs=oai_dv;
rrh_mod.devs->type=EXMIMO_IF;
LOG_I(RRH,"Setting RF device to EXMIMO\n");
#elif OAI_USRP
rrh_mod.devs=oai_dv;
rrh_mod.devs->type=USRP_B200_IF;
LOG_I(RRH,"Setting RF device to USRP\n");
#elif OAI_BLADERF
rrh_mod.devs=oai_dv;
rrh_mod.devs->type=BLADERF_IF;
LOG_I(RRH,"Setting RF device to BLADERF\n");
#else
rrh_mod.devs=oai_dv;
rrh_mod.devs->type=NONE_IF;
LOG_I(RRH,"Setting RF interface to NONE_IF... \n");
#endif
rrh_mod.devs->type=NONE_DEV;
rrh_mod.devs->transp_type=NONE_TP;
rrh_mod.devs->host_type=RRH_HOST;
return rrh_mod;
}
static void debug_init(void) {
// log initialization
/* log initialization */
logInit();
set_glog(glog_level, glog_verbosity);
......@@ -241,7 +245,7 @@ static void debug_init(void) {
//set_comp_log(ENB_LOG, enb_log_level, enb_log_verbosity, 1);
//set_comp_log(UE_LOG, ue_log_level, ue_log_verbosity, 1);
// vcd initialization
/* vcd initialization */
if (ouput_vcd) {
vcd_signal_dumper_init("/tmp/openair_dump_rrh.vcd");
......@@ -253,7 +257,7 @@ static void get_options(int argc, char *argv[]) {
int opt;
while ((opt = getopt(argc, argv, "xvhlte:n:u:g:r:w:i:")) != -1) {
while ((opt = getopt(argc, argv, "xvhlte:n:u:g:r:m:i:")) != -1) {
switch (opt) {
case 'n':
......@@ -273,6 +277,9 @@ static void get_options(int argc, char *argv[]) {
printf("RRH interface name is set to %s\n", if_name);
}
break;
case 'm':
eth_mode=atoi(optarg);
break;
case 'r':
//rrh_log_level=atoi(optarg);
break;
......@@ -293,16 +300,12 @@ static void get_options(int argc, char *argv[]) {
loopback_flag=1;
break;
case 't':
/*When measurements are enabled statistics related to TX/RX time are printed*/
/* When measurements are enabled statistics related to TX/RX time are printed */
measurements_flag=1;
break;
case 'w':
/* force to use this target*/
hardware_target=1;
break;
case 'h':
print_help();
exit(-1);
break;
case 'h':
print_help();
exit(-1);
default: /* '?' */
//fprintf(stderr, "Usage: \n", argv[0]);
exit(-1);
......@@ -311,31 +314,34 @@ static void get_options(int argc, char *argv[]) {
}
static int get_ip_address(char* if_name) {
static int get_address(char* if_name, uint8_t flag) {
int fd;
struct ifreq ifr;
fd = socket(AF_INET, SOCK_DGRAM, 0);
fd = socket(AF_INET, SOCK_DGRAM, 0);
/* I want to get an IPv4 IP address */
ifr.ifr_addr.sa_family = AF_INET;
ifr.ifr_addr.sa_family = AF_INET;
/* I want IP address attached to "if_name" */
strncpy(ifr.ifr_name, if_name, IFNAMSIZ-1);
if ( ioctl(fd, SIOCGIFADDR, &ifr)<0 ) {
perror("IOCTL:");
exit(-1);
}
if (flag==ETH_UDP_MODE) {
if ( ioctl(fd, SIOCGIFADDR, &ifr)<0 ) {
perror("IOCTL:");
exit(-1);
}
snprintf(&rrh_ip[0],20,"%s", inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
LOG_I(RRH,"%s: IP address: %s\n",if_name,rrh_ip);
} else if (flag==ETH_RAW_MODE) {
if ( ioctl(fd, SIOCGIFHWADDR, &ifr)<0 ) {
perror("IOCTL:");
exit(-1);
}
ether_ntoa_r ((unsigned char *)ifr.ifr_hwaddr.sa_data, rrh_mac);
LOG_I(RRH,"%s: MAC address: %s\n",if_name,rrh_mac);
}
close(fd);
/* display result */
snprintf(&rrh_ip[0],20,"%s", inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
LOG_I(RRH,"Got IP address %s from interface %s\n", rrh_ip,if_name);
return 0;
}
......@@ -343,19 +349,19 @@ static int get_ip_address(char* if_name) {
static void print_help(void) {
puts("Usage: \n");
puts(" sudo -E chrt 99 ./rrh -n1 -g6 -v -t");
puts(" sudo -E chrt 99 ./rrh -n1 -g6 -v -t -i lo -m1");
puts("Options:\n");
puts("\t -n create eNB module\n");
puts("\t -u create UE module\n");
puts("\t -g define global log level\n");
puts("\t -i set the RRH interface (default lo)\n");
puts("\t -m set ethernet mode to be used by RRH, valid options: (1:raw, 0:udp) \n");
puts("\t -r define rrh log level\n");
puts("\t -e define eNB log level\n");
puts("\t -x enable real time bahaviour\n");
puts("\t -v enable vcd dump\n");
puts("\t -l enable loopback mode\n");
puts("\t -t enable measurements\n");
puts("\t -w force to use specified HW\n");
puts("\t -h display info\n");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment