Commit 3e99c7aa authored by Cedric Roux's avatar Cedric Roux

Merge remote-tracking branch 'origin/develop-nbiotconf-shlibloader' into...

Merge remote-tracking branch 'origin/develop-nbiotconf-shlibloader' into develop_integration_2018_w10

1) shared library loader, with integration for oai devices, encoder and telnet server
2) telnet server (use build-oai --build-telnetsrv option and --telnetsrv softmodem option)
3) UE/eNB in different executables (lte-uesoftmodem and lte-softmodem + noS1 variants)
4) config module fixes and extensions
5) very preliminary NB-IoT integration preparation, using shared lib loader ( use make NB-IoT to build, after building the eNB softmodem)
6) Rename NB-IoT configuration sources from nbiot_ to NB-IoT_ to be consistent with other NB-IoT developments.
parents 307e2f29 da50d68b
......@@ -314,7 +314,8 @@ file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h)
set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
add_library(RRC_LIB ${rrc_h} ${rrc_source}
${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c)
${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c
${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c)
include_directories ("${RRC_FULL_DIR}")
# add the command to generate the source code
......@@ -1042,6 +1043,19 @@ include_directories(${NFAPI_USER_DIR})
# Layer 1
#############################
set(PHY_TURBOSRC
${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder.c
)
set(PHY_TURBOIF
${OPENAIR1_DIR}/PHY/CODING/coding_load.c
)
add_library(coding MODULE ${PHY_TURBOSRC} )
set(PHY_SRC
# depend on code generation from asn1c
${RRC_FULL_DIR}/asn1_constants.h
......@@ -1109,11 +1123,8 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${PHY_TURBOIF}
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
${OPENAIR1_DIR}/PHY/CODING/viterbi.c
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
......@@ -1206,9 +1217,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${PHY_TURBOIF}
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
${OPENAIR1_DIR}/PHY/CODING/viterbi.c
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
......@@ -1373,6 +1382,7 @@ set (MAC_SRC_UE
set (ENB_APP_SRC
${OPENAIR2_DIR}/ENB_APP/enb_app.c
${OPENAIR2_DIR}/ENB_APP/enb_config.c
${OPENAIR2_DIR}/ENB_APP/RRC_config_tools.c
)
add_library(L2
......@@ -1708,6 +1718,17 @@ if(NAS_UE)
endif()
# nbiot
add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16")
set (NBIOT_SOURCES
${OPENAIR2_DIR}/ENB_APP/NB_IoT_config.c
)
add_library(NB_IoT MODULE ${NBIOT_SOURCES} )
# shared library loader
set (SHLIB_LOADER_SOURCES
${OPENAIR_DIR}/common/utils/load_module_shlib.c
)
# Make lfds as a own source code (even if it is a outside library)
# For better intergration with compilation flags & structure of cmake
......@@ -1780,6 +1801,7 @@ include_directories("${NFAPI_DIR}/nfapi/inc")
include_directories("${NFAPI_DIR}/sim_common/inc")
include_directories("${NFAPI_DIR}/pnf_sim/inc")
# System packages that are required
# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
# or cmake provide a generic interface to pkg-config that widely used
......@@ -1935,14 +1957,13 @@ add_executable(lte-softmodem
${s1ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
......@@ -1958,9 +1979,9 @@ add_executable(lte-softmodem
target_link_libraries (lte-softmodem
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
......@@ -1975,14 +1996,13 @@ add_executable(lte-softmodem-nos1
${s1ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
......@@ -1996,9 +2016,9 @@ add_executable(lte-softmodem-nos1
)
target_link_libraries (lte-softmodem-nos1
-Wl,--start-group
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB}
${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl )
target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES})
......@@ -2006,6 +2026,76 @@ target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt
target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 ${T_LIB})
# lte-uesoftmodem is UE implementation
#######################################
add_executable(lte-uesoftmodem
${rrc_h}
${s1ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries (lte-uesoftmodem
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2_UE
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
-Wl,--end-group z dl)
target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES})
target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-uesoftmodem ${T_LIB})
# lte-softmodem-nos1 is both eNB and UE implementation
###################################################
add_executable(lte-uesoftmodem-nos1
${rrc_h}
${s1ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR_DIR}/common/utils/system.c
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries (lte-uesoftmodem-nos1
-Wl,--start-group
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_UE_LIB PHY_UE LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB}
${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
-Wl,--end-group z dl )
target_link_libraries (lte-uesoftmodem-nos1 ${LIBXML2_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
# USIM process
#################
#add_executable(usim
......@@ -2398,3 +2488,8 @@ ADD_CUSTOM_TARGET(oarf
DEPENDS ${OCT_FILES}
)
include (${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_CMakeLists.txt)
......@@ -359,7 +359,11 @@ function main() {
CMAKE_CMD="$CMAKE_CMD .."
echo_info "CMAKE_CMD=$CMAKE_CMD"
if [ "$eNB" = "1" ] && [ "$UE" = "1" ]; then
echo_error "Cannot build UE and eNB on one build_oai execution"
echo_error "use 2 build_oai invocations"
exit
fi
#########################################################
# check validity of HW and TP parameters for eNB
#########################################################
......@@ -488,10 +492,20 @@ function main() {
DIR=$OPENAIR_DIR/cmake_targets
if [ "$NOS1" = "1" ] ; then
lte_build_dir=lte_noS1_build_oai
lte_exec=lte-softmodem-nos1
if [ "$eNB" = "1" ] ; then
lte_exec=lte-softmodem-nos1
fi
if [ "$UE" = "1" ] ; then
lte_exec=lte-uesoftmodem-nos1
fi
else
lte_build_dir=lte_build_oai
lte_exec=lte-softmodem
if [ "$eNB" = "1" ] ; then
lte_exec=lte-softmodem
fi
if [ "$UE" = "1" ] ; then
lte_exec=lte-uesoftmodem
fi
fi
# configuration module libraries, one currently available, using libconfig
......@@ -544,6 +558,9 @@ function main() {
compilations \
$lte_build_dir $config_libconfig_shlib \
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
compilations \
$lte_build_dir coding \
libcoding.so $dbin/libcoding.so
if [ "$NOS1" = "1" ] ; then
compilations \
......@@ -766,17 +783,10 @@ function main() {
# Telnet server compilation
#####################
if [ "$BUILD_TELNETSRV" = "1" ] ; then
telnetsrv_build_dir=telnetsrv
mkdir -p $DIR/$telnetsrv_build_dir/build
cd $DIR/$telnetsrv_build_dir/build
echo_info "Compiling telnet server library ..."
[ "$CLEAN" = "1" ] && rm -rf $DIR/$telnetsrv_build_dir
cmake_file=$OPENAIR_DIR/common/utils/$telnetsrv_build_dir/CMakeLists.txt
cd $DIR/$telnetsrv_build_dir/build
eval "$CMAKE_CMD $OPENAIR_DIR/common/utils/$telnetsrv_build_dir/"
make
build_dir=$lte_build_dir
compilations \
$build_dir telnetsrv \
libtelnetsrv.so $dbin/libtelnetsrv.so
fi
# build RF device and transport protocol libraries
......
......@@ -5,6 +5,7 @@
RRC_Rel14=(
"SystemInformation-r8-IEs.h" 4df485c5ddf2540eca271876cdc512caa19b0890 "fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff"
"SystemInformation-NB-r13-IEs.h" 6d91332d5c39205819b06e5e36efe62ff8e5b33b "fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff"
)
RRC_Rel10=(
......
48a49,70
> struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member {
> SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR present;
> union SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_u {
> SystemInformationBlockType2_NB_r13_t sib2_r13;
> SystemInformationBlockType3_NB_r13_t sib3_r13;
> SystemInformationBlockType4_NB_r13_t sib4_r13;
> SystemInformationBlockType5_NB_r13_t sib5_r13;
> SystemInformationBlockType14_NB_r13_t sib14_r13;
> SystemInformationBlockType16_NB_r13_t sib16_r13;
> /*
> * This type is extensible,
> * possible extensions are below.
> */
> SystemInformationBlockType15_NB_r14_t sib15_v1430;
> SystemInformationBlockType20_NB_r14_t sib20_v1430;
> SystemInformationBlockType22_NB_r14_t sib22_v1430;
> } choice;
>
> /* Context for parsing across buffer boundaries */
> asn_struct_ctx_t _asn_ctx;
> };
>
52,72c74
< A_SEQUENCE_OF(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member {
< SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR present;
< union SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_u {
< SystemInformationBlockType2_NB_r13_t sib2_r13;
< SystemInformationBlockType3_NB_r13_t sib3_r13;
< SystemInformationBlockType4_NB_r13_t sib4_r13;
< SystemInformationBlockType5_NB_r13_t sib5_r13;
< SystemInformationBlockType14_NB_r13_t sib14_r13;
< SystemInformationBlockType16_NB_r13_t sib16_r13;
< /*
< * This type is extensible,
< * possible extensions are below.
< */
< SystemInformationBlockType15_NB_r14_t sib15_v1430;
< SystemInformationBlockType20_NB_r14_t sib20_v1430;
< SystemInformationBlockType22_NB_r14_t sib22_v1430;
< } choice;
<
< /* Context for parsing across buffer boundaries */
< asn_struct_ctx_t _asn_ctx;
< } ) list;
---
> A_SEQUENCE_OF(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member) list;
......@@ -197,25 +197,40 @@ int i;
return cfgptr;
}
void end_configmodule()
/* free memory allocated when reading parameters */
/* config module could be initialized again after this call */
void end_configmodule(void)
{
if (cfgptr != NULL) {
if (cfgptr->end != NULL) {
printf ("[CONFIG] calling config module end function...\n");
cfgptr->end();
}
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
for (int i=0; i<cfgptr->num_cfgP; i++) {
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
}
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
for(int i=0; i<cfgptr->numptrs ; i++) {
if (cfgptr->ptrs[i] != NULL) {
free(cfgptr->ptrs[i]);
cfgptr->ptrs[i]=NULL;
}
cfgptr->ptrs[i]=NULL;
}
cfgptr->numptrs=0;
}
}
/* free all memory used by config module */
/* should be called only at program exit */
void free_configmodule(void)
{
if (cfgptr != NULL) {
end_configmodule();
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
for (int i=0; i<cfgptr->num_cfgP; i++) {
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
}
free(cfgptr);
cfgptr=NULL;
......
......@@ -3,7 +3,7 @@
* 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.0 (the "License"); you may not use this file
* 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
*
......@@ -40,15 +40,18 @@
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
/* rtflags bit position definitions */
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR 2 // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE 4 // print command line processing messages
#define CONFIG_HELP 8 // print help message
#define CONFIG_ABORT 16 // config failed,abort execution
#define CONFIG_NOOOPT 32 // no -O option found when parsing command line
/* default values for configuration module parameters */
#define DEFAULT_CFGMODE "libconfig" // use libconfig file
#define DEFAULT_CFGFILENAME "oai.conf" // default config file
/* rtflags bit position definitions */
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR 1<<1 // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE 1<<2 // print command line processing messages
#define CONFIG_NOABORTONCHKF 1<<3 // disable abort execution when parameter checking function fails
#define CONFIG_HELP 1<<20 // print help message
#define CONFIG_ABORT 1<<21 // config failed,abort execution
#define CONFIG_NOOOPT 1<<22 // no -O option found when parsing command line
typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
......
......@@ -3,7 +3,7 @@
* 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.0 (the "License"); you may not use this file
* 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
*
......@@ -55,16 +55,61 @@
#define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions
#define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
#define CONFIG_MAX_NUMCHECKVAL 20
typedef struct paramdef paramdef_t;
typedef union checkedparam {
struct {
int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
int num_okintval; /* number of valid values in the checkingval array */
} s1;
struct {
int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
/* to the corresponding item in setintval array (mainly for RRC params) */
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
int num_okintval; /* number of valid values in the checkingval array */
} s1a;
struct {
int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
} s2;
struct {
int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
int num_okstrval; /* number of valid values in the checkingval array */
} s3;
struct {
int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
/* to the corresponding item in setintval array (mainly for RRC params) */
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
int num_okstrval; /* number of valid values in the checkingval array */
} s3a;
struct {
int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
} s4;
struct {
void (*checkfunc)(void) ;
} s5;
} checkedparam_t;
/* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */
/* config apis used to retrieve parameters values */
typedef struct paramdef
{
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
char *helpstr; /* help string */
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
union { /* pointer to the parameter value, completed by the config module */
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
char *helpstr; /* help string */
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
union { /* pointer to the parameter value, completed by the config module */
char **strptr;
char **strlistptr;
uint8_t *u8ptr;
char *i8ptr;
int8_t *i8ptr;
uint16_t *u16ptr;
int16_t *i16ptr;
uint32_t *uptr;
......@@ -72,18 +117,21 @@ typedef struct paramdef
uint64_t *u64ptr;
int64_t *i64ptr;
double *dblptr;
void *voidptr;
} ;
union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
char *defstrval;
char **defstrlistval;
uint32_t defuintval;
int defintval;
uint64_t defint64val;
int *defintarrayval;
double defdblval;
char *defstrval;
char **defstrlistval;
uint32_t defuintval;
int defintval;
uint64_t defint64val;
int *defintarrayval;
double defdblval;
} ;
char type; /* parameter value type, as listed below as TYPE_XXXX macro */
int numelt; /* number of elements in a list or array parameters or max size of string value */
checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */
int *processedvalue; /* used to store integer values computed from string original value */
} paramdef_t;
#define TYPE_INT TYPE_INT32
......
......@@ -3,7 +3,7 @@
* 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.0 (the "License"); you may not use this file
* 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
*
......@@ -36,6 +36,7 @@
#include <errno.h>
#include <dlfcn.h>
#include "config_userapi.h"
extern void exit_fun(const char* s); // lte-softmodem clean exit function
configmodule_interface_t *config_get_if(void)
......@@ -59,7 +60,7 @@ char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
*ptr = malloc(length);
if ( *ptr != NULL) {
memset(*ptr,0,length);
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) != 0) {
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
config_get_if()->ptrs[config_get_if()->numptrs] = *ptr;
config_get_if()->numptrs++;
}
......@@ -111,7 +112,29 @@ int tmpval=val;
break;
}
}
void config_assign_processedint(paramdef_t *cfgoption, int val) {
cfgoption->processedvalue = malloc(sizeof(int));
if ( cfgoption->processedvalue != NULL) {
*(cfgoption->processedvalue) = val;
} else {
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
exit(-1);
}
}
int config_get_processedint(paramdef_t *cfgoption) {
int ret;
if ( cfgoption->processedvalue != NULL) {
ret=*(cfgoption->processedvalue);
free( cfgoption->processedvalue);
cfgoption->processedvalue=NULL;
printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret);
} else {
fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
ret=0;
}
return ret;
}
void config_printhelp(paramdef_t *params,int numparams)
{
for (int i=0 ; i<numparams ; i++) {
......@@ -124,11 +147,31 @@ void config_printhelp(paramdef_t *params,int numparams)
}
}
int config_execcheck(paramdef_t *params,int numparams, char *prefix)
{
int st=0;
for (int i=0 ; i<numparams ; i++) {
if ( params[i].chkPptr == NULL) {
continue;
}
if (params[i].chkPptr->s4.f4 != NULL) {
st += params[i].chkPptr->s4.f4(&(params[i]));
}
}
if (st != 0) {
fprintf(stderr,"[CONFIG] config_execcheck: %i parameters with wrong value\n", -st);
if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
exit_fun("exit because configuration failed\n");
}
}
return st;
}
int config_get(paramdef_t *params,int numparams, char *prefix)
{
int ret= -1;
printf("numparams:%d prefix:%s\n", numparams, prefix);
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n");
return ret;
......@@ -138,6 +181,7 @@ configmodule_interface_t *cfgif = config_get_if();
ret = config_get_if()->get(params, numparams,prefix);
if (ret >= 0) {
config_process_cmdline(params,numparams,prefix);
config_execcheck(params,numparams,prefix);
}
return ret;
}
......@@ -153,6 +197,89 @@ int config_isparamset(paramdef_t *params,int paramidx)
}
}
int config_getparamval_fromparamdefidx(paramdef_t *cfgoptions,int paramidx) {
void print_intvalueerror(paramdef_t *param, char *fname, int *okval, int numokval) {
fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n ",
fname,param->optname, (int)*(param->uptr));
for ( int i=0; i<numokval ; i++) {
fprintf(stderr, " %i",okval[i]);
}
fprintf(stderr, " \n");
}
int config_check_intval(paramdef_t *param)
{
if ( param == NULL ){
fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n");
return -1;
}
for ( int i=0; i<param->chkPptr->s1.num_okintval ; i++) {
if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) {
return 0;
}
}
print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval);
return -1;
}
int config_check_modify_integer(paramdef_t *param)
{
for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) {
if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
*(param->uptr) = param->chkPptr->s1a.setintval [i];
return 0;
}
}
print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval);
return -1;
}
int config_check_intrange(paramdef_t *param)
{
if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) {
return 0;
}
fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n",
param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]);
return -1;
}
void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numokval) {
fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n ",
fname,param->optname, *(param->strptr));
for ( int i=0; i<numokval ; i++) {
fprintf(stderr, " %s",okval[i]);
}
fprintf(stderr, " \n");
}
int config_check_strval(paramdef_t *param)
{
if ( param == NULL ){
fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n");
return -1;
}
for ( int i=0; i<param->chkPptr->s3.num_okstrval ; i++) {
if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) {
return 0;
}
}
print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval);
return -1;
}
int config_checkstr_assign_integer(paramdef_t *param)
{
for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) {
config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
return 0;
}
}
print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval);
return -1;
}
......@@ -3,7 +3,7 @@
* 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.0 (the "License"); you may not use this file
* 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
*
......@@ -38,24 +38,34 @@
extern "C"
{
#endif
#define DEFAULT_CFGFILENAME "oaisoftmodem.conf"
#define DEFAULT_CFGMODE "libconfig"
#define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode )
#define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP )
#define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] )
#define CONFIG_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0 : !!(config_get_if()->rtflags & P))
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
/* utility functions, to be used by configuration module and/or configuration libraries */
extern configmodule_interface_t *config_get_if(void);
extern char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
extern void config_printhelp(paramdef_t *,int numparams);
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
extern int config_get(paramdef_t *params,int numparams, char *prefix);
extern int config_isparamset(paramdef_t *params,int paramidx);
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
extern int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix);
extern int config_getparamval_fromparamdefidx(paramdef_t *cfgoptions,int paramidx);
/* apis to get parameters, to be used by oai modules, at configuration time */
extern int config_get(paramdef_t *params,int numparams, char *prefix);
#define config_getlist config_get_if()->getlist
/* apis to retrieve parameters info after calling get or getlist functions */
extern int config_isparamset(paramdef_t *params,int paramidx);
extern int config_get_processedint(paramdef_t *cfgoption);
/* functions to be used in parameters definition, to check parameters values */
extern int config_check_intval(paramdef_t *param);
extern int config_check_modify_integer(paramdef_t *param);
extern int config_check_intrange(paramdef_t *param);
extern int config_check_strval(paramdef_t *param);
extern int config_checkstr_assign_integer(paramdef_t *param);
#define CONFIG_GETCONFFILE (config_get_if()->cfgP[0])
#ifdef __cplusplus
......
/*
* 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 common/config/libconfig/config_libconfig.c
* \brief: implementation libconfig configuration library
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define _GNU_SOURCE
#include <libconfig.h>
......@@ -21,21 +51,23 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
{
const char *str;
int st;
int numelt;
cfgoptions->numelt=config_setting_length(setting);
cfgoptions->strlistptr=malloc(sizeof(char *) * (cfgoptions->numelt));
numelt=config_setting_length(setting);
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
st=0;
for (int i=0; i< cfgoptions->numelt && cfgoptions->strlistptr != NULL; i++) {
for (int i=0; i< numelt ; i++) {
str=config_setting_get_string_elem(setting,i);
if (str==NULL) {
printf("[LIBCONFIG] %s%i not found in config file\n", cfgoptions->optname,i);
} else {
cfgoptions->strlistptr[i]=malloc(strlen(str)+1);
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1);
sprintf(cfgoptions->strlistptr[i],"%s",str);
st++;
printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
}
}
cfgoptions->numelt=numelt;
return st;
}
......@@ -108,10 +140,10 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
sprintf( *(cfgoptions[i].strptr) , "%s", str);
printf_params("[LIBCONFIG] %s: %s\n", cfgpath,*(cfgoptions[i].strptr) );
printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) );
} else {
sprintf( (char *)(cfgoptions[i].strptr) , "%s", str);
printf_params("[LIBCONFIG] %s: %s\n", cfgpath,(char *)cfgoptions[i].strptr );
printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr );
}
} else {
if( cfgoptions[i].defstrval != NULL) {
......@@ -121,10 +153,10 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1);
sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, *(cfgoptions[i].strptr));
printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, *(cfgoptions[i].strptr));
} else {
sprintf((char *)(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, (char *)cfgoptions[i].strptr);
sprintf((char *)*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, (char *)*(cfgoptions[i].strptr));
}
} else {
notfound=1;
......@@ -374,6 +406,7 @@ void config_libconfig_end(void )
config_destroy(&(libconfig_privdata.cfg));
if ( libconfig_privdata.configfile != NULL ) {
free(libconfig_privdata.configfile);
libconfig_privdata.configfile=NULL;
}
}
......@@ -48,6 +48,8 @@
#include "NwGtpv1uPrivate.h"
#include "gtpv1u_eNB_defs.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "RRC/LITE/defs_NB_IoT.h"
typedef struct {
/// RAN context config file name
char *config_file_name;
......@@ -55,12 +57,18 @@ typedef struct {
int nb_inst;
/// Number of Component Carriers per instance in this node
int *nb_CC;
/// Number of NB_IoT instances in this node
int nb_nb_iot_rrc_inst;
/// Number of MACRLC instances in this node
int nb_macrlc_inst;
/// Number of NB_IoT MACRLC instances in this node
int nb_nb_iot_macrlc_inst;
/// Number of component carriers per instance in this node
int *nb_mac_CC;
/// Number of L1 instances in this node
int nb_L1_inst;
/// Number of NB_IoT L1 instances in this node
int nb_nb_iot_L1_inst;
/// Number of Component Carriers per instance in this node
int *nb_L1_CC;
/// Number of RU instances in this node
......@@ -69,10 +77,16 @@ typedef struct {
flexran_agent_info_t **flexran;
/// eNB context variables
struct PHY_VARS_eNB_s ***eNB;
/// NB_IoT L1 context variables
struct PHY_VARS_eNB_NB_IoT_s **L1_NB_IoT;
/// RRC context variables
struct eNB_RRC_INST_s **rrc;
/// RRC context variables
/// NB_IoT RRC context variables
//struct eNB_RRC_INST_NB_IoT_s **nb_iot_rrc;
/// MAC context variables
struct eNB_MAC_INST_s **mac;
/// NB_IoT MAC context variables
struct eNB_MAC_INST_NB_IoT_s **nb_iot_mac;
/// GTPu descriptor
gtpv1u_data_t *gtpv1u_data_g;
/// RU descriptors. These describe what each radio unit is supposed to do and contain the necessary functions for fronthaul interfaces
......
......@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <dlfcn.h>
#include "openair1/PHY/defs.h"
......@@ -44,68 +45,162 @@
void loader_init(void) {
paramdef_t LoaderParams[] = LOADER_PARAMS_DESC;
loader_data.mainexec_buildversion = PACKAGE_VERSION;
int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),LOADER_CONFIG_PREFIX);
if (ret <0) {
fprintf(stderr,"[LOADER] configuration couldn't be performed");
printf("[LOADER] configuration couldn't be performed via config module, parameters set to default values\n");
if (loader_data.shlibpath == NULL) {
loader_data.shlibpath=DEFAULT_PATH;
}
return;
}
loader_data.maxshlibs = DEFAULT_MAXSHLIBS;
}
loader_data.shlibs = malloc(loader_data.maxshlibs * sizeof(loader_shlibdesc_t));
if(loader_data.shlibs == NULL) {
fprintf(stderr,"[LOADER] %s %d memory allocation error %s\n",__FILE__, __LINE__,strerror(errno));
exit_fun("[LOADER] unrecoverable error");
}
memset(loader_data.shlibs,0,loader_data.maxshlibs * sizeof(loader_shlibdesc_t));
}
/* build the full shared lib name from the module name */
char *loader_format_shlibpath(char *modname)
{
char *tmpstr;
char *shlibpath =NULL;
char *shlibversion=NULL;
char *cfgprefix;
paramdef_t LoaderParams[] ={{"shlibpath", NULL, 0, strptr:&shlibpath, defstrval:NULL, TYPE_STRING, 0},
{"shlibversion", NULL, 0, strptr:&shlibversion, defstrval:"", TYPE_STRING, 0}};
int ret;
/* looks for specific path for this module in the config file */
/* specific value for a module path and version is located in a modname subsection of the loader section */
/* shared lib name is formatted as lib<module name><module version>.so */
cfgprefix = malloc(sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16);
if (cfgprefix == NULL) {
fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
exit_fun("[LOADER] unrecoverable error");
} else {
sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),cfgprefix);
if (ret <0) {
fprintf(stderr,"[LOADER] %s %d couldn't retrieve config from section %s\n",__FILE__, __LINE__,cfgprefix);
}
}
/* no specific path, use loader default shared lib path */
if (shlibpath == NULL) {
shlibpath = loader_data.shlibpath ;
}
/* no specific shared lib version */
if (shlibversion == NULL) {
shlibversion = "" ;
}
/* alloc memory for full module shared lib file name */
tmpstr = malloc(strlen(shlibpath)+strlen(modname)+strlen(shlibversion)+16);
if (tmpstr == NULL) {
fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
exit_fun("[LOADER] unrecoverable error");
}
if(shlibpath[0] != 0) {
ret=sprintf(tmpstr,"%s/",shlibpath);
} else {
ret = 0;
}
sprintf(tmpstr+ret,"lib%s%s.so",modname,shlibversion);
return tmpstr;
}
int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
{
void *lib_handle;
initfunc_t fpi;
char *tmpstr;
checkverfunc_t fpc;
getfarrayfunc_t fpg;
char *shlib_path;
char *afname=NULL;
int ret=0;
if (loader_data.shlibpath == NULL) {
loader_init();
}
tmpstr = malloc(strlen(loader_data.shlibpath)+strlen(modname)+16);
if (tmpstr == NULL) {
fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
return -1;
}
if(loader_data.shlibpath[0] != 0) {
ret=sprintf(tmpstr,"%s/",loader_data.shlibpath);
}
if(strstr(modname,".so") == NULL) {
sprintf(tmpstr+ret,"lib%s.so",modname);
} else {
sprintf(tmpstr+ret,"%s",modname);
}
shlib_path = loader_format_shlibpath(modname);
ret = 0;
lib_handle = dlopen(tmpstr, RTLD_LAZY|RTLD_NODELETE|RTLD_GLOBAL);
lib_handle = dlopen(shlib_path, RTLD_LAZY|RTLD_NODELETE|RTLD_GLOBAL);
if (!lib_handle) {
fprintf(stderr,"[LOADER] library %s is not loaded: %s\n", tmpstr,dlerror());
fprintf(stderr,"[LOADER] library %s is not loaded: %s\n", shlib_path,dlerror());
ret = -1;
} else {
printf("[LOADER] library %s uccessfully loaded loaded\n", tmpstr);
sprintf(tmpstr,"%s_autoinit",modname);
fpi = dlsym(lib_handle,tmpstr);
printf("[LOADER] library %s successfully loaded\n", shlib_path);
afname=malloc(strlen(modname)+15);
sprintf(afname,"%s_checkbuildver",modname);
fpc = dlsym(lib_handle,afname);
if (fpc != NULL ){
int chkver_ret = fpc(loader_data.mainexec_buildversion, &(loader_data.shlibs[loader_data.numshlibs].shlib_buildversion));
if (chkver_ret < 0) {
fprintf(stderr,"[LOADER] %s %d lib %s, version mismatch",__FILE__, __LINE__, modname);
exit_fun("[LOADER] unrecoverable error");
}
}
sprintf(afname,"%s_autoinit",modname);
fpi = dlsym(lib_handle,afname);
if (fpi != NULL )
{
if (fpi != NULL ) {
fpi();
}
}
if (farray != NULL) {
loader_data.shlibs[loader_data.numshlibs].funcarray=malloc(numf*sizeof(loader_shlibfunc_t));
loader_data.shlibs[loader_data.numshlibs].numfunc=0;
for (int i=0; i<numf; i++) {
farray[i].fptr = dlsym(lib_handle,farray[i].fname);
if (farray[i].fptr == NULL ) {
fprintf(stderr,"[LOADER] %s %d %s function not found %s\n",__FILE__, __LINE__, dlerror(),farray[i].fname);
ret= -1;
}
ret= -1;
} else { /* farray[i].fptr == NULL */
loader_data.shlibs[loader_data.numshlibs].funcarray[i].fname=strdup(farray[i].fname);
loader_data.shlibs[loader_data.numshlibs].funcarray[i].fptr = farray[i].fptr;
loader_data.shlibs[loader_data.numshlibs].numfunc++;
}/* farray[i].fptr != NULL */
} /* for int i... */
} /* farray ! NULL */
}
} else { /* farray ! NULL */
sprintf(afname,"%s_getfarray",modname);
fpg = dlsym(lib_handle,afname);
if (fpg != NULL ) {
loader_data.shlibs[loader_data.numshlibs].numfunc = fpg(&(loader_data.shlibs[loader_data.numshlibs].funcarray));
}
} /* farray ! NULL */
loader_data.shlibs[loader_data.numshlibs].name=strdup(modname);
loader_data.shlibs[loader_data.numshlibs].thisshlib_path=strdup(shlib_path);
(loader_data.numshlibs)++;
} /* lib_handle != NULL */
if (tmpstr != NULL) free(tmpstr);
if ( shlib_path!= NULL) free(shlib_path);
if ( afname!= NULL) free(afname);
if (lib_handle != NULL) dlclose(lib_handle);
return ret;
}
void * get_shlibmodule_fptr(char *modname, char *fname)
{
for (int i=0; i<loader_data.numshlibs && loader_data.shlibs[i].name != NULL; i++) {
if ( strcmp(loader_data.shlibs[i].name, modname) == 0) {
for (int j =0; j<loader_data.shlibs[i].numfunc ; j++) {
if (strcmp(loader_data.shlibs[i].funcarray[j].fname, fname) == 0) {
return loader_data.shlibs[i].funcarray[j].fptr;
}
} /* for j loop on module functions*/
}
} /* for i loop on modules */
return NULL;
}
......@@ -33,33 +33,60 @@
#define LOAD_SHLIB_H
typedef int(*initfunc_t)(void);
typedef struct {
char *shlibpath;
}loader_data_t;
typedef struct {
char *fname;
int (*fptr)(void);
}loader_shlibfunc_t;
typedef struct {
char *name;
char *shlib_version; //
char *shlib_buildversion;
char *thisshlib_path;
uint32_t numfunc;
loader_shlibfunc_t *funcarray;
}loader_shlibdesc_t;
typedef struct {
char *mainexec_buildversion;
char *shlibpath;
uint32_t maxshlibs;
uint32_t numshlibs;
loader_shlibdesc_t *shlibs;
}loader_data_t;
/* function type of functions which may be implemented by a module */
/* 1: init function, called when loading, if found in the shared lib */
typedef int(*initfunc_t)(void);
/* 2: version checking function, called when loading, if it returns -1, trigger main exec abort */
typedef int(*checkverfunc_t)(char * mainexec_version, char ** shlib_version);
/* 3: get function array function, called when loading when a module doesn't provide */
/* the function array when calling load_module_shlib (farray param NULL) */
typedef int(*getfarrayfunc_t)(loader_shlibfunc_t **funcarray);
#ifdef LOAD_MODULE_SHLIB_MAIN
#define LOADER_CONFIG_PREFIX "loader"
#define DEFAULT_PATH ""
#define DEFAULT_PATH ""
#define DEFAULT_MAXSHLIBS 10
loader_data_t loader_data;
/*--------------------------------------------------------------------------------------------------------------------------------------*/
/* LOADER parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOADER parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOADER_PARAMS_DESC { \
{"shlibpath", NULL, 0, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0} \
{"shlibpath", NULL, PARAMFLAG_NOFREE, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0}, \
{"maxshlibs", NULL, 0, uptr:&(loader_data.maxshlibs), defintval:DEFAULT_MAXSHLIBS, TYPE_UINT32, 0}, \
}
/*-------------------------------------------------------------------------------------------------------------*/
#else
#else /* LOAD_MODULE_SHLIB_MAIN */
extern int load_module_shlib(char *modname, loader_shlibfunc_t *farray, int numf);
#endif
extern void * get_shlibmodule_fptr(char *modname, char *fname);
extern loader_data_t loader_data;
#endif /* LOAD_MODULE_SHLIB_MAIN */
#endif
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
IF(DEFINED ENV{OPENAIR_DIR})
message("...using oai source files in $ENV{OPENAIR_DIR}")
ELSE()
message("OPENAIR_DIR is not defined. You must run \"source oaienv\" from the oai root dir")
# exit early
return()
ENDIF()
set(OPENAIR_DIR $ENV{OPENAIR_DIR})
set(APPROOT ${OPENAIR_DIR}/common/utils/telnetsrv )
set(OPENAIR_BUILD_DIR $ENV{OPENAIR_DIR}/cmake_targets)
set(OPENAIR1_DIR $ENV{OPENAIR1_DIR})
set(OPENAIR2_DIR $ENV{OPENAIR2_DIR})
set(OPENAIR3_DIR $ENV{OPENAIR3_DIR})
set(OPENAIR_PHY_DIR $ENV{OPENAIR1_DIR}/PHY)
set(OPENAIR_TARGET_DIR $ENV{OPENAIR_DIR}/targets)
set(OPENAIR_COMMONUTILS_DIR $ENV{OPENAIR_DIR}/common/utils)
set(OPENAIR2_COMMON_DIR $ENV{OPENAIR_DIR}/openair2/COMMON)
set(OPENAIR_ASN1INC ${OPENAIR_BUILD_DIR}/lte_build_oai/build/CMakeFiles/Rel14)
set(OPENAIR_NFAPIINC $ENV{NFAPI_DIR} )
set(CMAKE_INSTALL_PREFIX $ENV{OPENAIR_TARGETS})
add_definitions (-DRel14 -DCMAKER -DENABLE_ITTI -DENABLE_NAS_UE_LOGGING -DENABLE_SECURITY -DENABLE_USE_CPU_EXECUTION_TIME -DENABLE_USE_MME -DENABLE_VCD -DENB_AGENT -DENB_MODE -DETHERNET=1 -DEXMIMO_IOT -DJUMBO_FRAME -DLINK_ENB_PDCP_TO_GTPV1U -DLOG_NO_THREAD -DMAC_CONTEXT -DMAX_NUM_CCs=1 -DNAS_BUILT_IN_UE -DNAS_UE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DNO_RRM -DNone=1 -DOAI_NW_DRIVER_USE_NETLINK -DOPENAIR2 -DOPENAIR_LTE -DPHYSIM -DPHY_CONTEXT -DRel10=1 -DS1AP_VERSION=R10 -DTRACE_RLC_MUTEX -DX2AP_VERSION=R11 -DXFORMS -mavx2 -msse4.1 -mssse3)
add_compile_options( -fPIC -march=native -Ofast)
include_directories( ./ ${OPENAIR_COMMON_DIR} ${OPENAIR_DIR} ${OPENAIR1_DIR} ${OPENAIR2_DIR} ${OPENAIR2_COMMON_DIR} ${OPENAIR2_DIR}/UTIL/LOG
${OPENAIR_COMMONUTILS_DIR}/msc ${OPENAIR_COMMONUTILS_DIR}/itti ${OPENAIR_COMMONUTILS_DIR}/hashtable ${OPENAIR_COMMONUTILS_DIR} ${OPENAIR_ASN1INC}
${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0 ${OPENAIR_COMMONUTILS_DIR}/msc ${OPENAIR_COMMONUTILS_DIR}/itti ${OPENAIR_COMMONUTILS_DIR}/hashtable ${OPENAIR_COMMONUTILS_DIR} ${OPENAIR_ASN1INC}
${OPENAIR2_DIR}/LAYER2/RLC ${OPENAIR2_DIR}/UTIL/LISTS ${OPENAIR2_DIR}/UTIL/MEM ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0
${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0 ${OPENAIR2_DIR}/RRC/LITE ${OPENAIR_TARGET_DIR}/COMMON ${OPENAIR_TARGET_DIR}/ARCH/COMMON
${OPENAIR3_DIR}/NAS/COMMON/API/NETWORK ${OPENAIR3_DIR}/NAS/COMMON/EMM/MSG/ ${OPENAIR3_DIR}/NAS/COMMON/IES/ ${OPENAIR3_DIR}/NAS/COMMON/UTIL
${OPENAIR3_DIR}/NAS/COMMON/ESM/MSG/ ${OPENAIR3_DIR}/GTPV1-U ${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared ${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include
${OPENAIR3_DIR}/UTILS ${OPENAIR_NFAPIINC})
set(TELNETSRV_SOURCE
${APPROOT}/telnetsrv.c
${APPROOT}/telnetsrv_phycmd.c
${APPROOT}/telnetsrv_proccmd.c
)
#set(TELNETSRV_ETHDEVCMD_SOURCE
# ${APPROOT}/telnetsrv/telnetsrv_ethdevcmd.c
# )
add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
#add_library(telnetsrv_ethdevcmd MODULE ${TELNETSRV_ETHDEVCMD_SOURCE} )
install(TARGETS telnetsrv DESTINATION bin)
if (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
install(TARGETS telnetsrv DESTINATION ${OPENAIR_BUILD_DIR}/lte_build_oai/build)
endif (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
This diff is collapsed.
......@@ -3,7 +3,7 @@
* 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.0 (the "License"); you may not use this file
* 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
*
......@@ -18,7 +18,6 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv.h
* \brief: include file for telnet server implementation
* \author Francois TABURET
......@@ -38,7 +37,7 @@
#define TELNET_MAX_MSGLENGTH 2048
#define TELNET_PROMPT "softmodem> "
#define TELNET_MAXCMD 20
#define TELNET_CMD_MAXSIZE 10
#define TELNET_CMD_MAXSIZE 20
#define TELNET_HELPSTR_SIZE 80
/* status return by the command parser after it analysed user input */
......@@ -70,7 +69,7 @@ typedef struct cmddef {
#define TELNET_VARTYPE_INT64 3
#define TELNET_VARTYPE_STRING 4
#define TELNET_VARTYPE_DOUBLE 5
#define TELNET_VARTYPE_PTR 6
//#define TELNET_VARTYPE_PTR 6
typedef struct variabledef {
char varname[TELNET_CMD_MAXSIZE];
char vartype;
......@@ -96,6 +95,8 @@ typedef struct {
pthread_t telnet_pthread; // thread id of the telnet server
int telnetdbg; // debug level of the server
int priority; // server running priority
char *histfile; // command history
int histsize; // command history length
int new_socket; // socket of the client connection
int logfilefd; // file id of the log file when log output is redirected to a file
int saved_stdout; // file id of the previous stdout, used to be able to restore original stdout
......@@ -130,10 +131,12 @@ VT escape sequence definition, for smarter display....
#define STDFMT "\x1b[0m"
/*---------------------------------------------------------------------------------------------*/
#define TELNET_ADDCMD_FNAME "add_telnetcmd"
typedef int(*add_telnetcmd_func_t)(char *, telnetshell_vardef_t *, telnetshell_cmddef_t *);
#ifdef TELNETSERVERCODE
int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd);
void set_sched(pthread_t tid, int pid,int priority);
void set_affinity(pthread_t tid, int pid, int coreid);
extern int get_phybsize();
extern int get_phybsize(void);
#endif
#endif
set(TELNETROOT ${OPENAIR_DIR}/common/utils/telnetsrv )
set(TELNETSRV_SOURCE
${TELNETROOT}/telnetsrv.c
${TELNETROOT}/telnetsrv_phycmd.c
${TELNETROOT}/telnetsrv_proccmd.c
${TELNETROOT}/telnetsrv_loader.c
)
#set(TELNETSRV_ETHDEVCMD_SOURCE
# ${APPROOT}/telnetsrv/telnetsrv_ethdevcmd.c
# )
add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
#add_library(telnetsrv_ethdevcmd MODULE ${TELNETSRV_ETHDEVCMD_SOURCE} )
target_link_libraries(telnetsrv PRIVATE history)
install(TARGETS telnetsrv DESTINATION bin)
if (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
install(TARGETS telnetsrv DESTINATION ${OPENAIR_BUILD_DIR}/lte_build_oai/build)
endif (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
/*
* 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 common/utils/telnetsrv/telnetsrv_loader.c
* \brief: implementation of telnet commands related to softmodem linux process
* \author Francois TABURET
* \date 2018
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define _GNU_SOURCE
#include <string.h>
#include <pthread.h>
#define TELNETSERVERCODE
#include "telnetsrv.h"
#define TELNETSRV_LOADER_MAIN
#include "telnetsrv_loader.h"
int loader_show_cmd(char *buff, int debug, telnet_printfunc_t prnt);
telnetshell_cmddef_t loader_cmdarray[] = {
{"show","[params,modules]",loader_show_cmd},
{"","",NULL},
};
/*-------------------------------------------------------------------------------------*/
int loader_show_cmd(char *buff, int debug, telnet_printfunc_t prnt)
{
if (debug > 0)
prnt( "loader_show_cmd received %s\n",buff);
if (strcasestr(buff,"params") != NULL) {
prnt( "loader parameters:\n");
prnt( " Main executable build version: \"%s\"\n", loader_data.mainexec_buildversion);
prnt( " Default shared lib path: \"%s\"\n", loader_data.shlibpath);
prnt( " Max number of shared lib : %i\n", loader_data.maxshlibs);
}
else if (strcasestr(buff,"modules") != NULL) {
prnt( "%i shared lib have been dynamicaly loaded by the oai loader\n", loader_data.numshlibs);
for (int i=0 ; i<loader_data.numshlibs ; i++) {
prnt( " Module %i: %s\n", i,loader_data.shlibs[i].name);
prnt( " Shared library build version: \"%s\"\n",((loader_data.shlibs[i].shlib_buildversion == NULL )?"":loader_data.shlibs[i].shlib_buildversion));
prnt( " Shared library path: \"%s\"\n", loader_data.shlibs[i].thisshlib_path);
prnt( " %i function pointers registered:\n", loader_data.shlibs[i].numfunc);
for(int j=0 ; j<loader_data.shlibs[i].numfunc;j++) {
prnt( " function %i %s at %p\n",j,
loader_data.shlibs[i].funcarray[j].fname, loader_data.shlibs[i].funcarray[j].fptr);
}
}
} else {
prnt("%s: wrong loader command...\n",buff);
}
return 0;
}
void add_loader_cmds(void)
{
add_telnetcmd("loader", loader_globalvardef, loader_cmdarray);
}
/*
* 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 common/utils/telnetsrv_proccmd.h
* \brief: Include file defining telnet commands related to softmodem linux process
* \author Francois TABURET
* \date 2018
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#ifdef TELNETSRV_LOADER_MAIN
#include "UTIL/LOG/log.h"
#include "common/utils/load_module_shlib.h"
telnetshell_vardef_t loader_globalvardef[] = {
{"mainversion",TELNET_VARTYPE_STRING,&(loader_data.mainexec_buildversion)},
{"defpath",TELNET_VARTYPE_STRING,&(loader_data.shlibpath)},
{"maxshlibs",TELNET_VARTYPE_INT32,&(loader_data.maxshlibs)},
{"numshlibs",TELNET_VARTYPE_INT32,&(loader_data.numshlibs)},
{"",0,NULL}
};
telnetshell_vardef_t *loader_modulesvardef;
extern void add_loader_cmds(void);
#endif
/*-------------------------------------------------------------------------------------*/
......@@ -41,7 +41,7 @@
char *prnbuff;
extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length);
void init_phytelnet()
void init_phytelnet(void)
{
prnbuff=malloc(get_phybsize() );
if (prnbuff == NULL)
......@@ -134,7 +134,7 @@ telnetshell_cmddef_t phy_cmdarray[] = {
/*-------------------------------------------------------------------------------------*/
void add_phy_cmds()
void add_phy_cmds(void)
{
init_phytelnet();
......
......@@ -42,8 +42,6 @@
#define TELNETVAR_PHYCC1 1
telnetshell_vardef_t phy_vardef[] = {
{"phycc1",TELNET_VARTYPE_PTR,NULL},
{"phycc2",TELNET_VARTYPE_PTR,NULL},
//{"iqmax",TELNET_VARTYPE_INT16,NULL},
//{"iqmin",TELNET_VARTYPE_INT16,NULL},
//{"loglvl",TELNET_VARTYPE_INT32,NULL},
......@@ -57,7 +55,7 @@ telnetshell_vardef_t phy_vardef[] = {
#else
extern void add_phy_cmds();
extern void add_phy_cmds(void);
#endif
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
* 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.0 (the "License"); you may not use this file
* 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
*
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv_proccmd.h
* \brief: Include file defining telnet commands related to this linux process
* \author Francois TABURET
......@@ -43,15 +44,33 @@ extern int proccmd_log(char *buf, int debug, telnet_printfunc_t prnt);
telnetshell_vardef_t proc_vardef[] = {
{"",0,NULL}
};
#define PROCCMD_LOG_HELP_STRING " log sub commands: \n\
show: display current log configuration \n\
online, noonline: enable or disable console logs \n\
enable, disable id1-id2: enable or disable logs for components index id1 to id2 \n\
level_<level> id1-id2: set log level to <level> for components index id1 to id2 \n\
level_<verbosity> id1-id2: set log verbosity to <verbosity> for components index id1 to id2 \n\
use the show command to get the values for <level>, <verbosity> and the list of component indexes \
that can be used for id1 and id2 \n"
#define PROCCMD_THREAD_HELP_STRING " thread sub commands: \n\
<thread id> aff <core> : set affinity of thread <thread id> to core <core> \n\
<thread id> prio <prio> : set scheduling parameters for thread <thread id> \n\
if prio < -20: linux scheduling policy set to FIFO, \n\
with priority = -20 - prio \n\
if prio > 19: linux scheduling policy set to OTHER, \n\
with priority (nice value) = prio \n\
use \"softmodem show thread\" to get <thread id> \n"
telnetshell_cmddef_t proc_cmdarray[] = {
{"show","loglvl|thread", proccmd_show},
{"log","[enable,disable]", proccmd_log},
{"thread","<id> aff|prio <aff|prio>", proccmd_thread},
{"show","loglvl|thread|config", proccmd_show},
{"log","(enter help for details)", proccmd_log},
{"thread","(enter help for details)", proccmd_thread},
{"exit","", proccmd_exit},
{"","",NULL},
};
#else
extern void add_proccmd_cmds();
extern void add_proccmd_cmds(void);
#endif /* TELNETSRV_PROCCMD_MAIN */
......@@ -21,7 +21,7 @@
#if !defined(NFAPI_PNF_H__)
#define NFAPI_PNF_H__
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
#endif
......@@ -27,7 +27,9 @@
#ifndef TC_MAIN
//#include "defs.h"
#endif
#include <stdint.h>
#include <stdio.h>
#include "PHY/CODING/defs.h"
#include "extern_3GPPinterleaver.h"
//#define DEBUG_TURBO_ENCODER 1
......@@ -35,7 +37,7 @@
uint32_t threegpplte_interleaver_output;
uint32_t threegpplte_interleaver_tmp;
inline void threegpplte_interleaver_reset()
inline void threegpplte_interleaver_reset(void)
{
threegpplte_interleaver_output = 0;
threegpplte_interleaver_tmp = 0;
......@@ -82,7 +84,7 @@ uint8_t output_lut[16],state_lut[16];
inline uint8_t threegpplte_rsc_lut(uint8_t input,uint8_t *state)
{
uint8_t output;
uint8_t off;
off = (*state<<1)|input;
......@@ -146,7 +148,7 @@ void threegpplte_turbo_encoder(uint8_t *input,
for (i=0; f1f2mat[i].nb_bits!= input_length_bits && i <188; i++);
if ( i == 188 ) {
msg("Illegal frame length!\n");
printf("Illegal frame length!\n");
return;
} else {
base_interleaver=il_tb+f1f2mat[i].beg_index;
......
......@@ -96,7 +96,7 @@ static inline void threegpplte_rsc_termination(unsigned char *x,unsigned char *z
*state = (*state)>>1;
}
void treillis_table_init(void)
static void treillis_table_init(void)
{
//struct treillis t[][]=all_treillis;
//t=memalign(16,sizeof(struct treillis)*8*256);
......@@ -536,12 +536,12 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
}
*/
void threegpplte_turbo_encoder(unsigned char *input,
unsigned short input_length_bytes,
unsigned char *output,
unsigned char F,
unsigned short interleaver_f1,
unsigned short interleaver_f2)
void threegpplte_turbo_encoder_sse(unsigned char *input,
unsigned short input_length_bytes,
unsigned char *output,
unsigned char F,
unsigned short interleaver_f1,
unsigned short interleaver_f2)
{
int i;
......@@ -641,7 +641,24 @@ void threegpplte_turbo_encoder(unsigned char *input,
#endif
}
void init_encoder_sse (void) {
treillis_table_init();
}
/* function which will be called by the shared lib loader, to check shared lib version
against main exec version. version mismatch no considered as fatal (interfaces not supposed to change)
*/
int coding_checkbuildver(char * mainexec_buildversion, char ** shlib_buildversion)
{
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "standalone built: " __DATE__ __TIME__
#endif
*shlib_buildversion = PACKAGE_VERSION;
if (strcmp(mainexec_buildversion, *shlib_buildversion) != 0) {
fprintf(stderr,"[CODING] shared lib version %s, doesn't match main version %s, compatibility should be checked\n",
mainexec_buildversion,*shlib_buildversion);
}
return 0;
}
#ifdef TC_MAIN
#define INPUT_LENGTH 20
......@@ -679,7 +696,7 @@ int main(int argc,char **argv)
printf("Input %d : %d\n",i,input[i]);
}
threegpplte_turbo_encoder(&input[0],
threegpplte_turbo_encoder_sse(&input[0],
INPUT_LENGTH,
&output[0],
0,
......
......@@ -550,7 +550,7 @@ void compute_alpha_s(llr_t* alpha,llr_t* m_11,llr_t* m_10,unsigned short frame_l
void compute_beta_s(llr_t* beta,llr_t *m_11,llr_t* m_10,llr_t* alpha,unsigned short frame_length,unsigned char F)
{
int k,i;
int k;
llr_t old0, old1, old2, old3, old4, old5, old6, old7;
llr_t new0, new1, new2, new3, new4, new5, new6, new7;
llr_t m_b0, m_b1, m_b2, m_b3, m_b4,m_b5, m_b6, m_b7;
......@@ -874,14 +874,22 @@ void compute_ext_s(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext,
unsigned char phy_threegpplte_turbo_decoder_scalar(llr_t *y,
llr_t *y2,
unsigned char *decoded_bytes,
unsigned char *decoded_bytes2,
unsigned short n,
unsigned short f1,
unsigned short f2,
unsigned char max_iterations,
unsigned char crc_type,
unsigned char F,
unsigned char inst)
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
{
/* y is a pointer to the input
......@@ -897,7 +905,7 @@ unsigned char phy_threegpplte_turbo_decoder_scalar(llr_t *y,
unsigned char crc_len,temp;
if (crc_type > 3) {
msg("Illegal crc length!\n");
fprintf(stderr,"Illegal crc length!\n");
return 255;
}
......
......@@ -37,9 +37,9 @@
///
///
#ifdef __AVX2__
#include "PHY/sse_intrin.h"
#ifndef TEST_DEBUG
#include "PHY/defs.h"
......@@ -58,6 +58,8 @@
#include "mex.h"
#endif
#ifdef __AVX2__
#include "PHY/sse_intrin.h"
//#define DEBUG_LOGMAP
......@@ -837,7 +839,7 @@ void free_td16avx2(void)
}
}
void init_td16avx2()
void init_td16avx2(void)
{
int ind,i,i2,i3,j,n,pi,pi2_i,pi2_pi;
......@@ -1408,6 +1410,36 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
#endif
return(iteration_cnt);
}
#else //__AVX2__
unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint16_t f1,
uint16_t f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
{
return 0;
}
void free_td16avx2(void)
{
}
void init_td16avx2(void)
{
}
#endif //__AVX2__
......
......@@ -1124,7 +1124,7 @@ void free_td16(void)
}
}
void init_td16()
void init_td16(void)
{
int ind,i,i2,i3,j,n,pi,pi3;
......@@ -1172,7 +1172,9 @@ void init_td16()
}
unsigned char phy_threegpplte_turbo_decoder16(short *y,
short *y2,
unsigned char *decoded_bytes,
unsigned char *decoded_bytes2,
unsigned short n,
unsigned short f1,
unsigned short f2,
......
......@@ -849,7 +849,7 @@ void free_td8(void)
extern RAN_CONTEXT_t RC;
void init_td8()
void init_td8(void)
{
int ind,i,j,n,n2,pi,pi3;
......@@ -898,7 +898,9 @@ void init_td8()
}
unsigned char phy_threegpplte_turbo_decoder8(short *y,
short y2,
unsigned char *decoded_bytes,
unsigned char *decoded_bytes2,
unsigned short n,
unsigned short f1,
unsigned short f2,
......
/*
* 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.0 (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 openair1/PHY/CODING
* \brief: load library implementing coding/decoding algorithms
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "common/utils/load_module_shlib.h"
#include "common/utils/telnetsrv/telnetsrv.h"
static int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt);
static telnetshell_cmddef_t coding_cmdarray[] = {
{"mode","[sse,avx2,stdc,none]",coding_setmod_cmd},
{"","",NULL},
};
telnetshell_vardef_t coding_vardef[] = {
{"maxiter",TELNET_VARTYPE_INT32,&max_turbo_iterations},
{"",0,NULL}
};
/* PHY/defs.h contains MODE_DECODE_XXX macros, following table must match */
static char *modedesc[] = {"none","sse","C","avx2"};
static int curmode;
/* function description array, to be used when loading the encoding/decoding shared lib */
loader_shlibfunc_t shlib_fdesc[DECODE_NUM_FPTR];
/* encoding decoding functions pointers, filled here and used when encoding/decoding */
/*defined as extern in PHY?CODING/extern.h */
decoder_if_t decoder16;
decoder_if_t decoder8;
encoder_if_t encoder;
extern int _may_i_use_cpu_feature(unsigned __int64);
uint8_t nodecod(short *y,
short *y2,
unsigned char *decoded_bytes,
unsigned char *decoded_bytes2,
unsigned short n,
unsigned short f1,
unsigned short f2,
unsigned char max_iterations,
unsigned char crc_type,
unsigned char F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
{
return max_iterations+1;
};
void decoding_setmode (int mode) {
switch (mode) {
case MODE_DECODE_NONE:
decoder8=nodecod;
decoder16=nodecod;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
break;
case MODE_DECODE_C:
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
break;
case MODE_DECODE_AVX2:
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
break;
default:
mode=MODE_DECODE_SSE;
case MODE_DECODE_SSE:
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
break;
}
curmode=mode;
}
int load_codinglib(void) {
int ret;
memset(shlib_fdesc,0,sizeof(shlib_fdesc));
shlib_fdesc[DECODE_INITTD8_SSE_FPTRIDX].fname = "init_td8";
shlib_fdesc[DECODE_INITTD16_SSE_FPTRIDX].fname= "init_td16";
shlib_fdesc[DECODE_INITTD_AVX2_FPTRIDX].fname="init_td16avx2";
shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fname= "phy_threegpplte_turbo_decoder8";
shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fname= "phy_threegpplte_turbo_decoder16";
shlib_fdesc[DECODE_TD_C_FPTRIDX].fname= "phy_threegpplte_turbo_decoder_scalar";
shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fname= "phy_threegpplte_turbo_decoder16avx2";
shlib_fdesc[DECODE_FREETD8_FPTRIDX].fname = "free_td8";
shlib_fdesc[DECODE_FREETD16_FPTRIDX].fname= "free_td16";
shlib_fdesc[DECODE_FREETD_AVX2_FPTRIDX].fname= "free_td16avx2";
shlib_fdesc[ENCODE_SSE_FPTRIDX].fname= "threegpplte_turbo_encoder_sse";
shlib_fdesc[ENCODE_C_FPTRIDX].fname= "threegpplte_turbo_encoder";
shlib_fdesc[ENCODE_INIT_SSE_FPTRIDX].fname= "init_encoder_sse";
ret=load_module_shlib("coding",shlib_fdesc,DECODE_NUM_FPTR);
if (ret < 0) exit_fun("Error loading coding library");
/* execute encoder/decoder init functions */
shlib_fdesc[DECODE_INITTD8_SSE_FPTRIDX].fptr();
shlib_fdesc[DECODE_INITTD16_SSE_FPTRIDX].fptr();
if(shlib_fdesc[DECODE_INITTD_AVX2_FPTRIDX].fptr != NULL) {
shlib_fdesc[DECODE_INITTD_AVX2_FPTRIDX].fptr();
}
if(shlib_fdesc[ENCODE_INIT_SSE_FPTRIDX].fptr != NULL) {
shlib_fdesc[ENCODE_INIT_SSE_FPTRIDX].fptr();
}
decoding_setmode(MODE_DECODE_SSE);
/* look for telnet server, if it is loaded, add the coding commands to it */
add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
if (addcmd != NULL) {
addcmd("coding",coding_vardef,coding_cmdarray);
}
return 0;
}
void free_codinglib(void) {
shlib_fdesc[DECODE_FREETD8_FPTRIDX].fptr();
shlib_fdesc[DECODE_FREETD16_FPTRIDX].fptr();
shlib_fdesc[DECODE_FREETD_AVX2_FPTRIDX].fptr();
}
/* functions for telnet support, when telnet server is loaded */
int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt)
{
if (debug > 0)
prnt( "coding_setmod_cmd received %s\n",buff);
if (strcasestr(buff,"sse") != NULL) {
decoding_setmode(MODE_DECODE_SSE);
} else if (strcasestr(buff,"avx2") != NULL) {
decoding_setmode(MODE_DECODE_AVX2);
} else if (strcasestr(buff,"stdc") != NULL) {
decoding_setmode(MODE_DECODE_C);
} else if (strcasestr(buff,"none") != NULL) {
decoding_setmode(MODE_DECODE_NONE);
} else {
prnt("%s: wrong setmod parameter...\n",buff);
}
prnt("Coding and decoding current mode: %s\n",modedesc[curmode]);
return 0;
}
......@@ -37,7 +37,7 @@
#define CRC8 3
#define MAX_TURBO_ITERATIONS_MBSFN 8
#define MAX_TURBO_ITERATIONS 4
#define MAX_TURBO_ITERATIONS max_turbo_iterations
#define LTE_NULL 2
......@@ -292,25 +292,9 @@ void ccodedot11_init(void);
\brief This function initializes the trellis structure for decoding an 802.11 convolutional code.*/
void ccodedot11_init_inv(void);
/*!\fn void teillis_table_init(void)
\brief This function initializes the trellis structure for 3GPP LTE Turbo code.*/
void treillis_table_init(void);
/*\fn void threegpplte_turbo_encoder(uint8_t *input,uint16_t input_length_bytes,uint8_t *output,uint8_t F,uint16_t interleaver_f1,uint16_t interleaver_f2)
\brief This function implements a rate 1/3 8-state parralel concatenated turbo code (3GPP-LTE).
@param input Pointer to input buffer
@param input_length_bytes Number of bytes to encode
@param output Pointer to output buffer
@param F Number of filler bits at input
@param interleaver_f1 F1 generator
@param interleaver_f2 F2 generator
*/
void threegpplte_turbo_encoder(uint8_t *input,
uint16_t input_length_bytes,
uint8_t *output,
uint8_t F,
uint16_t interleaver_f1,
uint16_t interleaver_f2);
/** \fn void ccodelte_encode(int32_t numbits,uint8_t add_crc, uint8_t *inPtr,uint8_t *outPtr,uint16_t rnti)
......@@ -352,35 +336,7 @@ void ccodedab_init_inv(void);
\brief This function initializes the different crc tables.*/
void crcTableInit (void);
/*!\fn void free_td8(void)
\brief This function frees the tables for 8-bit LLR Turbo decoder.*/
void free_td8(void);
/*!\fn void init_td8(void)
\brief This function initializes the tables for 8-bit LLR Turbo decoder.*/
void init_td8 (void);
/*!\fn void free_td16(void)
\brief This function frees the tables for 16-bit LLR Turbo decoder.*/
void free_td16(void);
/*!\fn void init_td16(void)
\brief This function initializes the tables for 16-bit LLR Turbo decoder.*/
void init_td16 (void);
#ifdef __AVX2__
/*!\fn void init_td8(void)
\brief This function initializes the tables for 8-bit LLR Turbo decoder (AVX2).*/
void init_td8avx2 (void);
/*!\fn void free_td16avx2(void)
\brief This function frees the tables for 16-bit LLR Turbo decoder (AVX2).*/
void free_td16avx2(void);
/*!\fn void init_td16(void)
\brief This function initializes the tables for 16-bit LLR Turbo decoder (AVX2).*/
void init_td16avx2 (void);
#endif
/*!\fn uint32_t crc24a(uint8_t *inPtr, int32_t bitlen)
\brief This computes a 24-bit crc ('a' variant for overall transport block)
......@@ -470,95 +426,7 @@ int32_t rate_matching_lte(uint32_t N_coded,
uint32_t off);
/*!
\brief This routine performs max-logmap detection for the 3GPP turbo code (with termination). It is optimized for SIMD processing and 16-bit
LLR arithmetic, and requires SSE2,SSSE3 and SSE4.1 (gcc >=4.3 and appropriate CPU)
@param y LLR input (16-bit precision)
@param decoded_bytes Pointer to decoded output
@param n number of coded bits (including tail bits)
@param max_iterations The maximum number of iterations to perform
@param interleaver_f1 F1 generator
@param interleaver_f2 F2 generator
@param crc_type Length of 3GPPLTE crc (CRC24a,CRC24b,CRC16,CRC8)
@param F Number of filler bits at start of packet
@returns number of iterations used (this is 1+max if incorrect crc or if crc_len=0)
*/
uint8_t phy_threegpplte_turbo_decoder16(int16_t *y,
uint8_t *decoded_bytes,
uint16_t n,
uint16_t interleaver_f1,
uint16_t interleaver_f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats);
uint8_t phy_threegpplte_turbo_decoder16avx2(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint16_t interleaver_f1,
uint16_t interleaver_f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats);
/*!
\brief This routine performs max-logmap detection for the 3GPP turbo code (with termination). It is optimized for SIMD processing and 8-bit
LLR arithmetic, and requires SSE2,SSSE3 and SSE4.1 (gcc >=4.3 and appropriate CPU)
@param y LLR input (16-bit precision)
@param decoded_bytes Pointer to decoded output
@param n number of coded bits (including tail bits)
@param max_iterations The maximum number of iterations to perform
@param interleaver_f1 F1 generator
@param interleaver_f2 F2 generator
@param crc_type Length of 3GPPLTE crc (CRC24a,CRC24b,CRC16,CRC8)
@param F Number of filler bits at start of packet
@returns number of iterations used (this is 1+max if incorrect crc or if crc_len=0)
*/
uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
uint8_t *decoded_bytes,
uint16_t n,
uint16_t interleaver_f1,
uint16_t interleaver_f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats);
uint8_t phy_threegpplte_turbo_decoder_scalar(int16_t *y,
uint8_t *decoded_bytes,
uint16_t n,
uint16_t interleaver_f1,
uint16_t interleaver_f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
uint8_t inst);
/** @} */
uint32_t crcbit (uint8_t * ,
int32_t,
......
This diff is collapsed.
......@@ -20,5 +20,9 @@
*/
extern unsigned short f1f2mat_old[2*188];
extern double cpuf;
extern decoder_if_t decoder16;
extern decoder_if_t decoder8;
extern encoder_if_t encoder;
extern int load_codinglib(void);
extern int free_codinglib(void);
/*
* 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.0 (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
*/
#ifndef __INIT_DEFS_NB_IOT__H__
#define __INIT_DEFS_NB_IOT__H__
//#include "PHY/defs_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "nfapi_interface.h"
//#include "SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h"
//#include "RadioResourceConfigDedicated.h"
//#include "TDD-Config.h"
//#include "MBSFN-SubframeConfigList.h"
//#include "MobilityControlInfo.h"
//#if defined(Rel10) || defined(Rel14)
//#include "SCellToAddMod-r10.h"
//#endif
/*brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB-NB decoding + primary/secondary synch).*/
void phy_config_mib_eNB_NB_IoT(int Mod_id,
int eutra_band,
int Nid_cell,
int Ncp,
int Ncp_UL,
int p_eNB,
uint16_t EARFCN,
uint16_t prb_index, // NB_IoT_RB_ID,
uint16_t operating_mode,
uint16_t control_region_size,
uint16_t eutra_NumCRS_ports);
/*NB_phy_config_sib1_eNB is not needed since NB-IoT use only FDD mode*/
/*brief Configure LTE_DL_FRAME_PARMS with components of SIB2-NB (at eNB).*/
//void NB_phy_config_sib2_eNB(module_id_t Mod_id,
// int CC_id,
// RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon
// );
void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id,
nfapi_nb_iot_config_t *config,
nfapi_rf_config_t *rf_config,
nfapi_uplink_reference_signal_config_t* ul_nrs_config,
extra_phyConfig_t* extra_phy_parms);
void phy_config_dedicated_eNB_NB_IoT(module_id_t Mod_id,
rnti_t rnti,
extra_phyConfig_t* extra_phy_parms);
// void phy_init_lte_top_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms);
void phy_init_nb_iot_eNB(PHY_VARS_eNB_NB_IoT *phyvar);
int l1_north_init_NB_IoT(void);
#endif
......@@ -22,7 +22,7 @@
/*!\brief Initilization and reconfiguration routines for LTE PHY */
#include "defs.h"
#include "PHY/extern.h"
#include "PHY/CODING/extern.h"
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
{
......@@ -34,15 +34,12 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
ccodelte_init();
ccodelte_init_inv();
treillis_table_init();
phy_generate_viterbi_tables();
phy_generate_viterbi_tables_lte();
init_td8();
init_td16();
#ifdef __AVX2__
init_td16avx2();
#endif
load_codinglib();
lte_sync_time_init(frame_parms);
generate_ul_ref_sigs();
......@@ -61,11 +58,7 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
void free_lte_top(void)
{
free_td8();
free_td16();
#ifdef __AVX2__
free_td16avx2();
#endif
free_codinglib();
lte_sync_time_free();
/* free_ul_ref_sigs() is called in phy_free_lte_eNB() */
......
......@@ -207,10 +207,8 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
((ue->frame_parms.frame_type == TDD) && ((subframe == 1) || (subframe == 6)))
)
{ // FDD PSS/SSS, compute noise in DTX REs
if (ue->frame_parms.Ncp==NORMAL) {
if (ue->frame_parms.Ncp == NORMAL) {
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
if(ue->frame_parms.frame_type == FDD)
{
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(5*ue->frame_parms.ofdm_symbol_size)];
......@@ -266,7 +264,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
} else {
LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length = EXTENDED\n");
LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length == EXTENDED\n");
}
}
else if ((ue->frame_parms.frame_type == TDD) &&
......
/*******************************************************************************
*******************************************************************************/
/*! \file PHY/LTE_REFSIG/defs_NB_IoT.c
* \function called by lte_dl_cell_spec_NB_IoT.c , TS 36-211, V13.4.0 2017-02
* \author M. KANJ
* \date 2017
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
/* Definitions for NB_IoT Reference signals */
#ifndef __LTE_REFSIG_DEFS_NB_IOT__H__
#define __LTE_REFSIG_DEFS_NB_IOT__H__
#include "PHY/defs_L1_NB_IoT.h"
/** @ingroup _PHY_REF_SIG
* @{
*/
/*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL reference signals.
@param frame_parms LTE DL Frame parameters
@param lte_gold_table pointer to table where sequences are stored
@param Nid_cell Cell Id for NB_IoT (to compute sequences for local and adjacent cells) */
void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint32_t lte_gold_table_NB_IoT[20][2][14],
uint16_t Nid_cell);
/*! \brief This function generates the Narrowband reference signal (NRS) sequence (36-211, Sec 6.10.1.1)
@param phy_vars_eNB Pointer to eNB variables
@param output Output vector for OFDM symbol (Frequency Domain)
@param amp Q15 amplitude
@param Ns Slot number (0..19)
@param l symbol (0,1) - Note 1 means 3!
@param p antenna index
@param RB_IoT_ID the ID of the RB dedicated for NB_IoT
*/
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,
int32_t *output,
short amp,
unsigned char Ns,
unsigned char l,
unsigned char p,
unsigned short RB_IoT_ID);
unsigned int lte_gold_generic_NB_IoT(unsigned int *x1,
unsigned int *x2,
unsigned char reset);
void generate_ul_ref_sigs_rx_NB_IoT(void);
void free_ul_ref_sigs_NB_IoT(void);
#endif
/*
* 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.0 (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.h
* \brief typedefs for LTE DCI structures from 36-212, V8.6 2009-03. Limited to 5 MHz formats for the moment.Current LTE compliance V8.6 2009-03.
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __DCI_NB_IOT_H__
#define __DCI_NB_IOT_H__
//#ifndef USER_MODE
//#include "PHY/types.h"
//#else
#include <stdint.h>
//#endif
typedef enum
{
DCIFormatN0 = 0,
DCIFormatN1,
DCIFormatN1_RA,//is for initial RA procedure (semi-static information) so maybe is not needed
DCIFormatN1_RAR,
DCIFormatN2,
DCIFormatN2_Ind,
DCIFormatN2_Pag,
}DCI_format_NB_IoT_t;
/// DCI Format Type 0 (180 kHz, 23 bits)
struct DCIFormatN0{
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type;
/// Subcarrier indication, 6 bits
uint8_t scind;
/// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign;
/// Modulation and Coding Scheme, 4 bits
uint8_t mcs;
/// New Data Indicator, 1 bits
uint8_t ndi;
/// Scheduling Delay, 2 bits
uint8_t Scheddly;
/// Repetition Number, 3 bits
uint8_t RepNum;
/// Redundancy version for HARQ (only use 0 and 2), 1 bits
uint8_t rv;
/// DCI subframe repetition Number, 2 bits
uint8_t DCIRep;
};
typedef struct DCIFormatN0 DCIFormatN0_t;
/// DCI Format Type N1 for User data
struct DCIFormatN1{
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1,1bits
uint8_t type;
//NPDCCH order indicator (set to 0), 1 bits
uint8_t orderIndicator;
// Scheduling Delay,3 bits
uint8_t Scheddly;
// Resourse Assignment (RU Assignment),3 bits
uint8_t ResAssign;
// Modulation and Coding Scheme,4 bits
uint8_t mcs;
// Repetition Number,4 bits
uint8_t RepNum;
// New Data Indicator,1 bits
uint8_t ndi;
// HARQ-ACK resource,4 bits
uint8_t HARQackRes;
// DCI subframe repetition Number,2 bits
uint8_t DCIRep;
};
typedef struct DCIFormatN1 DCIFormatN1_t;
/// DCI Format Type N1 for initial RA
struct DCIFormatN1_RA{
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type;
//NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator;
// Start number of NPRACH repetiiton, 2 bits
uint8_t Scheddly;
// Subcarrier indication of NPRACH, 6 bits
uint8_t scind;
// All the remainging bits, 13 bits
uint8_t remaingingBits;
};
typedef struct DCIFormatN1_RA DCIFormatN1_RA_t;
/// DCI Format Type N1 for User data
struct DCIFormatN1_RAR{
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1,1bits
uint8_t type;
//NPDCCH order indicator (set to 0), 1 bits
uint8_t orderIndicator;
// Scheduling Delay,3 bits
uint8_t Scheddly;
// Resourse Assignment (RU Assignment),3 bits
uint8_t ResAssign;
// Modulation and Coding Scheme,4 bits
uint8_t mcs;
// Repetition Number,4 bits
uint8_t RepNum;
// New Data Indicator,1 bits,reserved in the RAR
uint8_t ndi;
// HARQ-ACK resource,4 bits,reserved in the RAR
uint8_t HARQackRes;
// DCI subframe repetition Number,2 bits
uint8_t DCIRep;
};
typedef struct DCIFormatN1_RAR DCIFormatN1_RAR_t;
// DCI Format Type N2 for direct indication, 15 bits
struct DCIFormatN2_Ind{
//Flag for paging(1)/direct indication(0), set to 0,1 bits
uint8_t type;
//Direct indication information, 8 bits
uint8_t directIndInf;
// Reserved information bits, 6 bits
uint8_t resInfoBits;
};
typedef struct DCIFormatN2_Ind DCIFormatN2_Ind_t;
// DCI Format Type N2 for Paging, 15 bits
struct DCIFormatN2_Pag{
//Flag for paging(1)/direct indication(0), set to 1,1 bits
uint8_t type;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign;
// Modulation and Coding Scheme, 4 bits
uint8_t mcs;
// Repetition Number, 4 bits
uint8_t RepNum;
// Reserved 3 bits
uint8_t DCIRep;
};
typedef struct DCIFormatN2_Pag DCIFormatN2_Pag_t;
typedef union DCI_CONTENT {
//
DCIFormatN0_t DCIN0;
//
DCIFormatN1_t DCIN1;
//
DCIFormatN1_RA_t DCIN1_RA;
//
DCIFormatN1_RAR_t DCIN1_RAR;
//
DCIFormatN2_Ind_t DCIN2_Ind;
//
DCIFormatN2_Pag_t DCIN2_Pag;
}DCI_CONTENT;
/*Structure for packing*/
struct DCIN0{
/// DCI subframe repetition Number, 2 bits
uint8_t DCIRep:2;
/// New Data Indicator, 1 bits
uint8_t ndi:1;
/// Repetition Number, 3 bits
uint8_t RepNum:3;
/// Redundancy version for HARQ (only use 0 and 2), 1 bits
uint8_t rv:1;
/// Modulation and Coding Scheme, 4 bits
uint8_t mcs:4;
/// Scheduling Delay, 2 bits
uint8_t Scheddly:2;
/// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign:3;
/// Subcarrier indication, 6 bits
uint8_t scind:6;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type:1;
} __attribute__ ((__packed__));
typedef struct DCIN0 DCIN0_t;
#define sizeof_DCIN0_t 23
struct DCIN1_RAR{
// DCI subframe repetition Number, 2 bits
uint8_t DCIRep:2;
// HARQ-ACK resource,4 bits
uint8_t HARQackRes:4;
// New Data Indicator,1 bits
uint8_t ndi:1;
// Repetition Number, 4 bits
uint8_t RepNum:4;
// Modulation and Coding Scheme, 4 bits
uint8_t mcs:4;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign:3;
// Scheduling Delay, 3 bits
uint8_t Scheddly:3;
//NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator:1;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type:1;
} __attribute__ ((__packed__));
typedef struct DCIN1_RAR DCIN1_RAR_t;
#define sizeof_DCIN1_RAR_t 23
struct DCIN1{
// DCI subframe repetition Number, 2 bits
uint8_t DCIRep:2;
// HARQ-ACK resource,4 bits
uint8_t HARQackRes:4;
// New Data Indicator,1 bits
uint8_t ndi:1;
// Repetition Number, 4 bits
uint8_t RepNum:4;
// Modulation and Coding Scheme, 4 bits
uint8_t mcs:4;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign:3;
// Scheduling Delay, 3 bits
uint8_t Scheddly:3;
//NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator:1;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type:1;
} __attribute__ ((__packed__));
typedef struct DCIN1 DCIN1_t;
#define sizeof_DCIN1_t 23
// DCI Format Type N2 for direct indication, 15 bits
struct DCIN2_Ind{
// Reserved information bits, 6 bits
uint8_t resInfoBits:6;
//Direct indication information, 8 bits
uint8_t directIndInf:8;
//Flag for paging(1)/direct indication(0), set to 0,1 bits
uint8_t type:1;
} __attribute__ ((__packed__));;
typedef struct DCIN2_Ind DCIN2_Ind_t;
#define sizeof_DCIN2_Ind_t 15
// DCI Format Type N2 for Paging, 15 bits
struct DCIN2_Pag{
// Reserved 3 bits
uint8_t DCIRep:3;
// Repetition Number, 4 bits
uint8_t RepNum:4;
// Modulation and Coding Scheme, 4 bits
uint8_t mcs:4;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign:3;
//Flag for paging(1)/direct indication(0), set to 1,1 bits
uint8_t type:1;
} __attribute__ ((__packed__));;
typedef struct DCIN2_Pag DCIN2_Pag_t;
#define sizeof_DCIN2_Pag_t 15
#define MAX_DCI_SIZE_BITS_NB_IoT 23
#endif
This diff is collapsed.
......@@ -286,13 +286,13 @@ int dlsch_encoding_2threads0(te_params *tep) {
threegpplte_turbo_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)
);
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)
);
dlsch->harq_processes[harq_pid]->RTC[r] =
sub_block_interleaving_turbo(4+(Kr_bytes*8),
&dlsch->harq_processes[harq_pid]->d[r][96],
......@@ -458,13 +458,13 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
start_meas(te_stats);
threegpplte_turbo_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)
);
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);
start_meas(i_stats);
......@@ -651,13 +651,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
threegpplte_turbo_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)
);
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
......@@ -833,13 +833,13 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
threegpplte_turbo_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)
);
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
......
......@@ -39,7 +39,6 @@
//#define DEBUG_DLSCH_DECODING
//#define UE_DEBUG_TRACE 1
extern double cpuf;
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
{
......@@ -206,21 +205,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
time_stats_t *);
#endif
uint8_t (*tc)(int16_t *y,
uint8_t *,
uint16_t,
uint16_t,
uint16_t,
uint8_t,
uint8_t,
uint8_t,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *);
decoder_if_t tc;
......@@ -255,13 +240,13 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
#if 0
tc_2cw = phy_threegpplte_turbo_decoder16avx2;
#endif
tc = phy_threegpplte_turbo_decoder16;
tc = decoder16;
}
else
{
AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
tc = phy_threegpplte_turbo_decoder8;
tc = decoder8;
}
......@@ -490,7 +475,9 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
ret = tc
(&harq_process->d[r][96],
NULL,
harq_process->c[r],
NULL,
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
......
......@@ -40,7 +40,7 @@
//#define DEBUG_LLR_SIC
int16_t zero[8] __attribute__ ((aligned(16))) = {0,0,0,0,0,0,0,0};
int16_t zeros[8] __attribute__ ((aligned(16))) = {0,0,0,0,0,0,0,0};
int16_t ones[8] __attribute__ ((aligned(16))) = {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff};
#if defined(__x86_64__) || defined(__i386__)
__m128i rho_rpi __attribute__ ((aligned(16)));
......
This diff is collapsed.
This diff is collapsed.
......@@ -371,13 +371,13 @@ uint32_t ulsch_encoding(uint8_t *a,
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
threegpplte_turbo_encoder(ulsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&ulsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? ulsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36212-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36212-820, page 14)
);
encoder(ulsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&ulsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? ulsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36212-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36212-820, page 14)
);
stop_meas(te_stats);
#ifdef DEBUG_ULSCH_CODING
......
This diff is collapsed.
......@@ -162,7 +162,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
int16_t **chest_t;
int16_t **chest_f;
int16_t *pusch_llr;
int16_t *pusch_comp;
int32_t *pusch_comp;
int32_t *pucch1_comp;
int32_t *pucch1_thres;
int32_t *pucch1ab_comp;
......@@ -200,7 +200,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
chest_t = (int16_t**) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates[eNB_id];
chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id];
pusch_llr = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->llr;
pusch_comp = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0];
pusch_comp = (int32_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0];
pucch1_comp = (int32_t*) phy_vars_enb->pucch1_stats[UE_id];
pucch1_thres = (int32_t*) phy_vars_enb->pucch1_stats_thres[UE_id];
pucch1ab_comp = (int32_t*) phy_vars_enb->pucch1ab_stats[UE_id];
......
......@@ -1461,6 +1461,53 @@ extern pthread_cond_t sync_cond;
extern pthread_mutex_t sync_mutex;
extern int sync_var;
#define MODE_DECODE_NONE 0
#define MODE_DECODE_SSE 1
#define MODE_DECODE_C 2
#define MODE_DECODE_AVX2 3
#define DECODE_INITTD8_SSE_FPTRIDX 0
#define DECODE_INITTD16_SSE_FPTRIDX 1
#define DECODE_INITTD_AVX2_FPTRIDX 2
#define DECODE_TD8_SSE_FPTRIDX 3
#define DECODE_TD16_SSE_FPTRIDX 4
#define DECODE_TD_C_FPTRIDX 5
#define DECODE_TD16_AVX2_FPTRIDX 6
#define DECODE_FREETD8_FPTRIDX 7
#define DECODE_FREETD16_FPTRIDX 8
#define DECODE_FREETD_AVX2_FPTRIDX 9
#define ENCODE_SSE_FPTRIDX 10
#define ENCODE_C_FPTRIDX 11
#define ENCODE_INIT_SSE_FPTRIDX 12
#define DECODE_NUM_FPTR 13
typedef uint8_t(*decoder_if_t)(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint16_t f1,
uint16_t f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats);
typedef uint8_t(*encoder_if_t)(uint8_t *input,
uint16_t input_length_bytes,
uint8_t *output,
uint8_t F,
uint16_t interleaver_f1,
uint16_t interleaver_f2);
#define MAX_RRU_CONFIG_SIZE 1024
typedef enum {
RAU_tick=0,
......
This diff is collapsed.
......@@ -126,6 +126,6 @@ extern unsigned short Nb_81_110[8][4];
extern uint16_t hundred_times_log10_NPRB[100];
extern uint8_t alpha_lut[8];
extern uint8_t max_turbo_iterations;
#endif /*__PHY_EXTERN_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -149,5 +149,5 @@ int16_t unscrambling_lut[65536*16] __attribute__((aligned(32)));
/// lookup table for scrambling in TX
uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
uint8_t max_turbo_iterations=4;
#endif /*__PHY_VARS_H__ */
......@@ -650,7 +650,7 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
{
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
uint8_t SR_payload = 0,pucch_b0b1[4][2]= {{0,0},{0,0},{0,0},{0,0}},harq_ack[4]={0,0,0,0};
int32_t metric[4]={0,0,0,0},metric_SR=0,max_metric;
int32_t metric[4]={0,0,0,0},metric_SR=0,max_metric=0;
const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx;
int i;
......
......@@ -36,6 +36,7 @@
#include "SCHED/extern.h"
#include "nfapi_interface.h"
#include "fapi_l1.h"
#include "nfapi_pnf.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
......
This diff is collapsed.
......@@ -54,6 +54,7 @@ MESSAGE_DEF(RRC_STATE_IND, MESSAGE_PRIORITY_MED, RrcStateInd,
//-------------------------------------------------------------------------------------------//
// eNB: ENB_APP -> RRC messages
MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigurationReq, rrc_configuration_req)
MESSAGE_DEF(NBIOTRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, NbIoTRrcConfigurationReq, nbiotrrc_configuration_req)
// UE: NAS -> RRC messages
MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment