Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
OpenXG-RAN
Commits
b04f3b54
Commit
b04f3b54
authored
Mar 01, 2018
by
oai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
introduce distinct executables for ue and eNodeB (lte-uesoftmodem, lte-softmodem)
parent
45302792
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1420 additions
and
549 deletions
+1420
-549
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+77
-13
cmake_targets/build_oai
cmake_targets/build_oai
+17
-3
common/utils/load_module_shlib.c
common/utils/load_module_shlib.c
+37
-15
common/utils/load_module_shlib.h
common/utils/load_module_shlib.h
+19
-9
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+8
-2
common/utils/telnetsrv/telnetsrv.h
common/utils/telnetsrv/telnetsrv.h
+2
-0
openair1/PHY/CODING/3gpplte_sse.c
openair1/PHY/CODING/3gpplte_sse.c
+1
-1
openair1/PHY/CODING/3gpplte_turbo_decoder.c
openair1/PHY/CODING/3gpplte_turbo_decoder.c
+9
-1
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
+2
-0
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
+2
-0
openair1/PHY/CODING/coding_load.c
openair1/PHY/CODING/coding_load.c
+61
-12
openair1/PHY/CODING/defs.h
openair1/PHY/CODING/defs.h
+3
-105
openair1/PHY/INIT/init_top.c
openair1/PHY/INIT/init_top.c
+1
-1
openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
+2
-4
openair1/PHY/extern.h
openair1/PHY/extern.h
+1
-1
openair1/PHY/vars.h
openair1/PHY/vars.h
+1
-1
openair2/RRC/LITE/L2_interface_ue.c
openair2/RRC/LITE/L2_interface_ue.c
+1
-0
openair2/RRC/LITE/rrc_UE.c
openair2/RRC/LITE/rrc_UE.c
+1
-1
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+33
-376
targets/RT/USER/lte-softmodem.h
targets/RT/USER/lte-softmodem.h
+3
-4
targets/RT/USER/lte-uesoftmodem.c
targets/RT/USER/lte-uesoftmodem.c
+1139
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
b04f3b54
...
...
@@ -1216,9 +1216,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
...
...
@@ -1946,14 +1944,12 @@ 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
${
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
...
...
@@ -1969,9 +1965,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
}
)
...
...
@@ -1986,14 +1982,12 @@ 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
${
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
...
...
@@ -2007,9 +2001,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
}
)
...
...
@@ -2017,6 +2011,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
...
...
cmake_targets/build_oai
View file @
b04f3b54
...
...
@@ -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
...
...
common/utils/load_module_shlib.c
View file @
b04f3b54
...
...
@@ -48,11 +48,11 @@ void loader_init(void) {
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] %s %d configuration couldn't be performed"
,
__FILE__
,
__LINE__
);
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
)
{
...
...
@@ -96,7 +96,10 @@ int ret;
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
)
{
...
...
@@ -120,6 +123,7 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
void
*
lib_handle
;
initfunc_t
fpi
;
checkverfunc_t
fpc
;
getfarrayfunc_t
fpg
;
char
*
shlib_path
;
char
*
afname
=
NULL
;
int
ret
=
0
;
...
...
@@ -155,25 +159,29 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
}
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
.
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
++
)
{
if
(
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
++
;
}
}
(
loader_data
.
numshlibs
)
++
;
}
/* lib_handle != NULL */
...
...
@@ -182,3 +190,17 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
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
;
}
common/utils/load_module_shlib.h
View file @
b04f3b54
...
...
@@ -33,8 +33,7 @@
#define LOAD_SHLIB_H
typedef
int
(
*
initfunc_t
)(
void
);
typedef
int
(
*
checkverfunc_t
)(
char
*
mainexec_version
,
char
**
shlib_version
);
typedef
struct
{
char
*
fname
;
...
...
@@ -58,23 +57,34 @@ typedef struct {
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, PARAMFLAG_NOFREE, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0}, \
{"maxshlibs", NULL, 0, uptr:&(loader_data.maxshlibs), defintval:
10,
TYPE_UINT32, 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
/* LOAD_MODULE_SHLIB_MAIN */
extern
int
load_module_shlib
(
char
*
modname
,
loader_shlibfunc_t
*
farray
,
int
numf
);
extern
void
*
get_shlibmodule_fptr
(
char
*
modname
,
char
*
fname
);
extern
loader_data_t
loader_data
;
#endif
/* LOAD_MODULE_SHLIB_MAIN */
...
...
common/utils/telnetsrv/telnetsrv.c
View file @
b04f3b54
...
...
@@ -51,7 +51,7 @@
#include <dlfcn.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "common/utils/load_module_shlib.h"
#include "common/config/config_userapi.h"
#include <readline/history.h>
...
...
@@ -787,4 +787,10 @@ int telnetsrv_checkbuildver(char * mainexec_buildversion, char ** shlib_buildve
return
0
;
}
int
telnetsrv_getfarray
(
loader_shlibfunc_t
**
farray
)
{
*
farray
=
malloc
(
sizeof
(
loader_shlibfunc_t
));
(
*
farray
)[
0
].
fname
=
TELNET_ADDCMD_FNAME
;
(
*
farray
)[
0
].
fptr
=
(
int
(
*
)(
void
)
)
add_telnetcmd
;
return
1
;
}
common/utils/telnetsrv/telnetsrv.h
View file @
b04f3b54
...
...
@@ -131,6 +131,8 @@ 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
);
...
...
openair1/PHY/CODING/3gpplte_sse.c
View file @
b04f3b54
...
...
@@ -696,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
,
...
...
openair1/PHY/CODING/3gpplte_turbo_decoder.c
View file @
b04f3b54
...
...
@@ -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
...
...
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
View file @
b04f3b54
...
...
@@ -1172,7 +1172,9 @@ void init_td16(void)
}
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
,
...
...
openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
View file @
b04f3b54
...
...
@@ -898,7 +898,9 @@ void init_td8(void)
}
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
,
...
...
openair1/PHY/CODING/coding_load.c
View file @
b04f3b54
...
...
@@ -29,13 +29,32 @@
* \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
;
...
...
@@ -59,7 +78,6 @@ uint8_t nodecod(short *y,
time_stats_t
*
intl1_stats
,
time_stats_t
*
intl2_stats
)
{
printf
(
"."
);
return
max_iterations
+
1
;
};
...
...
@@ -70,11 +88,6 @@ void decoding_setmode (int mode) {
decoder16
=
nodecod
;
encoder
=
(
encoder_if_t
)
shlib_fdesc
[
ENCODE_C_FPTRIDX
].
fptr
;
break
;
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
;
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
;
...
...
@@ -85,15 +98,22 @@ void decoding_setmode (int mode) {
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"
;
...
...
@@ -117,10 +137,18 @@ int load_codinglib(void) {
/* execute encoder/decoder init functions */
shlib_fdesc
[
DECODE_INITTD8_SSE_FPTRIDX
].
fptr
();
shlib_fdesc
[
DECODE_INITTD16_SSE_FPTRIDX
].
fptr
();
shlib_fdesc
[
DECODE_INITTD_AVX2_FPTRIDX
].
fptr
();
shlib_fdesc
[
ENCODE_INIT_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
;
}
...
...
@@ -132,3 +160,24 @@ void free_codinglib(void) {
}
/* 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
;
}
openair1/PHY/CODING/defs.h
View file @
b04f3b54
...
...
@@ -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
...
...
@@ -294,21 +294,7 @@ void ccodedot11_init_inv(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)
...
...
@@ -440,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
,
...
...
openair1/PHY/INIT/init_top.c
View file @
b04f3b54
...
...
@@ -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
)
{
...
...
openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
View file @
b04f3b54
...
...
@@ -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
)
&&
...
...
openair1/PHY/extern.h
View file @
b04f3b54
...
...
@@ -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__ */
openair1/PHY/vars.h
View file @
b04f3b54
...
...
@@ -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__ */
openair2/RRC/LITE/L2_interface_ue.c
View file @
b04f3b54
...
...
@@ -65,6 +65,7 @@ mac_rrc_data_req_ue(
)
//--------------------------------------------------------------------------
{
#ifdef DEBUG_RRC
int
i
;
LOG_I
(
RRC
,
"[eNB %d] mac_rrc_data_req to SRB ID=%d
\n
"
,
Mod_idP
,
Srb_id
);
...
...
openair2/RRC/LITE/rrc_UE.c
View file @
b04f3b54
...
...
@@ -242,6 +242,7 @@ openair_rrc_on_ue(
{
unsigned
short
i
;
LOG_I
(
RRC
,
PROTOCOL_RRC_CTXT_FMT
" UE?:OPENAIR RRC IN....
\n
"
,
PROTOCOL_RRC_CTXT_ARGS
(
ctxt_pP
));
...
...
@@ -4841,7 +4842,6 @@ rrc_rx_tx_ue(
)
//-----------------------------------------------------------------------------
{
//uint8_t UE_id;
#ifdef LOCALIZATION
double
estimated_distance
;
...
...
targets/RT/USER/lte-softmodem.c
View file @
b04f3b54
...
...
@@ -135,7 +135,6 @@ volatile int oai_exit = 0;
static
clock_source_t
clock_source
=
internal
;
static
int
wait_for_sync
=
0
;
static
int8_t
UE_flag
=
0
;
unsigned
int
mmapped_dma
=
0
;
int
single_thread_flag
=
1
;
...
...
@@ -322,7 +321,7 @@ void signal_handler(int sig) {
void
exit_fun
(
const
char
*
s
)
{
int
CC_id
;
int
ru_id
;
if
(
s
!=
NULL
)
{
...
...
@@ -331,33 +330,22 @@ void exit_fun(const char* s)
oai_exit
=
1
;
if
(
UE_flag
==
0
)
{
if
(
RC
.
ru
==
NULL
)
exit
(
-
1
);
// likely init not completed, prevent crash or hang, exit now...
for
(
ru_id
=
0
;
ru_id
<
RC
.
nb_RU
;
ru_id
++
)
{
if
(
RC
.
ru
[
ru_id
]
->
rfdevice
.
trx_end_func
)
if
(
RC
.
ru
[
ru_id
]
&&
RC
.
ru
[
ru_id
]
->
rfdevice
.
trx_end_func
)
RC
.
ru
[
ru_id
]
->
rfdevice
.
trx_end_func
(
&
RC
.
ru
[
ru_id
]
->
rfdevice
);
if
(
RC
.
ru
[
ru_id
]
->
ifdevice
.
trx_end_func
)
if
(
RC
.
ru
[
ru_id
]
&&
RC
.
ru
[
ru_id
]
->
ifdevice
.
trx_end_func
)
RC
.
ru
[
ru_id
]
->
ifdevice
.
trx_end_func
(
&
RC
.
ru
[
ru_id
]
->
ifdevice
);
}
}
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
oai_exit
=
1
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
if
(
UE_flag
==
0
)
{
}
else
{
if
(
PHY_vars_UE_g
[
0
][
CC_id
]
->
rfdevice
.
trx_end_func
)
PHY_vars_UE_g
[
0
][
CC_id
]
->
rfdevice
.
trx_end_func
(
&
PHY_vars_UE_g
[
0
][
CC_id
]
->
rfdevice
);
}
}
#if defined(ENABLE_ITTI)
sleep
(
1
);
//allow lte-softmodem threads to exit first
itti_terminate_tasks
(
TASK_UNKNOWN
);
#endif
}
}
...
...
@@ -390,9 +378,9 @@ void reset_stats(FL_OBJECT *button, long arg)
}
static
void
*
scope_thread
(
void
*
arg
)
{
char
stats_buffer
[
16384
];
# ifdef ENABLE_XFORMS_WRITE_STATS
FILE
*
UE_stats
,
*
eNB_stats
;
FILE
*
eNB_stats
;
# endif
struct
sched_param
sched_param
;
int
UE_id
,
CC_id
;
...
...
@@ -405,47 +393,15 @@ static void *scope_thread(void *arg) {
# ifdef ENABLE_XFORMS_WRITE_STATS
if
(
UE_flag
==
1
)
UE_stats
=
fopen
(
"UE_stats.txt"
,
"w"
);
else
eNB_stats
=
fopen
(
"eNB_stats.txt"
,
"w"
);
eNB_stats
=
fopen
(
"eNB_stats.txt"
,
"w"
);
#endif
while
(
!
oai_exit
)
{
if
(
UE_flag
==
1
)
{
dump_ue_stats
(
PHY_vars_UE_g
[
0
][
0
],
&
PHY_vars_UE_g
[
0
][
0
]
->
proc
.
proc_rxtx
[
0
],
stats_buffer
,
0
,
mode
,
rx_input_level_dBm
);
//fl_set_object_label(form_stats->stats_text, stats_buffer);
fl_clear_browser
(
form_stats
->
stats_text
);
fl_add_browser_line
(
form_stats
->
stats_text
,
stats_buffer
);
phy_scope_UE
(
form_ue
[
0
],
PHY_vars_UE_g
[
0
][
0
],
0
,
0
,
7
);
}
else
{
/*
if (RC.eNB[0][0]->mac_enabled==1) {
len = dump_eNB_l2_stats (stats_buffer, 0);
//fl_set_object_label(form_stats_l2->stats_text, stats_buffer);
fl_clear_browser(form_stats_l2->stats_text);
fl_add_browser_line(form_stats_l2->stats_text, stats_buffer);
}
len = dump_eNB_stats (RC.eNB[0][0], stats_buffer, 0);
if (MAX_NUM_CCs>1)
len += dump_eNB_stats (RC.eNB[0][1], &stats_buffer[len], 0);
//fl_set_object_label(form_stats->stats_text, stats_buffer);
fl_clear_browser(form_stats->stats_text);
fl_add_browser_line(form_stats->stats_text, stats_buffer);
*/
ue_cnt
=
0
;
for
(
UE_id
=
0
;
UE_id
<
NUMBER_OF_UE_MAX
;
UE_id
++
)
{
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
// if ((RC.eNB[0][CC_id]->dlsch[UE_id][0]->rnti>0) && (ue_cnt<scope_enb_num_ue)) {
if
((
ue_cnt
<
scope_enb_num_ue
))
{
phy_scope_eNB
(
form_enb
[
CC_id
][
ue_cnt
],
RC
.
eNB
[
0
][
CC_id
],
...
...
@@ -453,12 +409,7 @@ static void *scope_thread(void *arg) {
ue_cnt
++
;
}
}
}
}
//printf("doing forms\n");
//usleep(100000); // 100 ms
}
sleep
(
1
);
}
...
...
@@ -466,19 +417,11 @@ static void *scope_thread(void *arg) {
# ifdef ENABLE_XFORMS_WRITE_STATS
if
(
UE_flag
==
1
)
{
if
(
UE_stats
)
{
rewind
(
UE_stats
);
fwrite
(
stats_buffer
,
1
,
len
,
UE_stats
);
fclose
(
UE_stats
);
}
}
else
{
if
(
eNB_stats
)
{
rewind
(
eNB_stats
);
fwrite
(
stats_buffer
,
1
,
len
,
eNB_stats
);
fclose
(
eNB_stats
);
}
}
# endif
...
...
@@ -497,7 +440,6 @@ void *l2l1_task(void *arg) {
itti_set_task_real_time
(
TASK_L2L1
);
itti_mark_task_ready
(
TASK_L2L1
);
if
(
UE_flag
==
0
)
{
/* Wait for the initialize message */
printf
(
"Wait for the ITTI initialize message
\n
"
);
do
{
...
...
@@ -530,8 +472,7 @@ void *l2l1_task(void *arg) {
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
message_p
),
message_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
}
/* ???? no else but seems to be UE only ???
do {
// Wait for a message
itti_receive_msg (TASK_L2L1, &message_p);
...
...
@@ -562,17 +503,17 @@ void *l2l1_task(void *arg) {
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
} while(!oai_exit);
*/
return
NULL
;
}
#endif
static
void
get_options
(
void
)
{
int
CC_id
;
int
tddflag
,
nonbiotflag
;
char
*
loopfile
=
NULL
;
int
dumpframe
;
uint32_t
online_log_messages
;
uint32_t
glog_level
,
glog_verbosity
;
uint32_t
start_telnetsrv
;
...
...
@@ -607,98 +548,19 @@ static void get_options(void) {
load_module_shlib
(
"telnetsrv"
,
NULL
,
0
);
}
if
(
UE_flag
>
0
)
{
uint8_t
n_rb_dl
;
paramdef_t
cmdline_uemodeparams
[]
=
CMDLINE_UEMODEPARAMS_DESC
;
paramdef_t
cmdline_ueparams
[]
=
CMDLINE_UEPARAMS_DESC
;
set_default_frame_parms
(
frame_parms
);
config_process_cmdline
(
cmdline_uemodeparams
,
sizeof
(
cmdline_uemodeparams
)
/
sizeof
(
paramdef_t
),
NULL
);
config_process_cmdline
(
cmdline_ueparams
,
sizeof
(
cmdline_ueparams
)
/
sizeof
(
paramdef_t
),
NULL
);
if
(
loopfile
!=
NULL
)
{
printf
(
"Input file for hardware emulation: %s"
,
loopfile
);
mode
=
loop_through_memory
;
input_fd
=
fopen
(
loopfile
,
"r"
);
AssertFatal
(
input_fd
!=
NULL
,
"Please provide a valid input file
\n
"
);
}
if
(
(
cmdline_uemodeparams
[
CMDLINE_CALIBUERX_IDX
].
paramflags
&
PARAMFLAG_PARAMSET
)
!=
0
)
mode
=
rx_calib_ue
;
if
(
(
cmdline_uemodeparams
[
CMDLINE_CALIBUERXMED_IDX
].
paramflags
&
PARAMFLAG_PARAMSET
)
!=
0
)
mode
=
rx_calib_ue_med
;
if
(
(
cmdline_uemodeparams
[
CMDLINE_CALIBUERXBYP_IDX
].
paramflags
&
PARAMFLAG_PARAMSET
)
!=
0
)
mode
=
rx_calib_ue_byp
;
if
(
*
(
cmdline_uemodeparams
[
CMDLINE_DEBUGUEPRACH_IDX
].
uptr
)
>
0
)
mode
=
debug_prach
;
if
(
*
(
cmdline_uemodeparams
[
CMDLINE_NOL2CONNECT_IDX
].
uptr
)
>
0
)
mode
=
no_L2_connect
;
if
(
*
(
cmdline_uemodeparams
[
CMDLINE_CALIBPRACHTX_IDX
].
uptr
)
>
0
)
mode
=
calib_prach_tx
;
if
(
dumpframe
>
0
)
mode
=
rx_dump_frame
;
if
(
downlink_frequency
[
0
][
0
]
>
0
)
{
printf
(
"Downlink frequency set to %u
\n
"
,
downlink_frequency
[
0
][
0
]);
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
frame_parms
[
CC_id
]
->
dl_CarrierFreq
=
downlink_frequency
[
0
][
0
];
}
UE_scan
=
0
;
}
if
(
tddflag
>
0
)
{
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
frame_parms
[
CC_id
]
->
frame_type
=
TDD
;
}
if
(
frame_parms
[
0
]
->
N_RB_DL
!=
0
)
{
if
(
frame_parms
[
0
]
->
N_RB_DL
<
6
)
{
frame_parms
[
0
]
->
N_RB_DL
=
6
;
printf
(
"%i: Invalid number of ressource blocks, adjusted to 6
\n
"
,
frame_parms
[
0
]
->
N_RB_DL
);
}
if
(
frame_parms
[
0
]
->
N_RB_DL
>
100
)
{
frame_parms
[
0
]
->
N_RB_DL
=
100
;
printf
(
"%i: Invalid number of ressource blocks, adjusted to 100
\n
"
,
frame_parms
[
0
]
->
N_RB_DL
);
}
if
(
frame_parms
[
0
]
->
N_RB_DL
>
50
&&
frame_parms
[
0
]
->
N_RB_DL
<
100
)
{
frame_parms
[
0
]
->
N_RB_DL
=
50
;
printf
(
"%i: Invalid number of ressource blocks, adjusted to 50
\n
"
,
frame_parms
[
0
]
->
N_RB_DL
);
}
if
(
frame_parms
[
0
]
->
N_RB_DL
>
25
&&
frame_parms
[
0
]
->
N_RB_DL
<
50
)
{
frame_parms
[
0
]
->
N_RB_DL
=
25
;
printf
(
"%i: Invalid number of ressource blocks, adjusted to 25
\n
"
,
frame_parms
[
0
]
->
N_RB_DL
);
}
UE_scan
=
0
;
frame_parms
[
0
]
->
N_RB_UL
=
frame_parms
[
0
]
->
N_RB_DL
;
for
(
CC_id
=
1
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
frame_parms
[
CC_id
]
->
N_RB_DL
=
frame_parms
[
0
]
->
N_RB_DL
;
frame_parms
[
CC_id
]
->
N_RB_UL
=
frame_parms
[
0
]
->
N_RB_UL
;
}
}
for
(
CC_id
=
1
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
tx_max_power
[
CC_id
]
=
tx_max_power
[
0
];
rx_gain
[
0
][
CC_id
]
=
rx_gain
[
0
][
0
];
tx_gain
[
0
][
CC_id
]
=
tx_gain
[
0
][
0
];
}
}
/* UE_flag > 0 */
#if T_TRACER
paramdef_t
cmdline_ttraceparams
[]
=
CMDLINE_TTRACEPARAMS_DESC
;
config_process_cmdline
(
cmdline_ttraceparams
,
sizeof
(
cmdline_ttraceparams
)
/
sizeof
(
paramdef_t
),
NULL
);
#endif
if
(
!
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
))
)
{
if
(
UE_flag
==
0
)
{
memset
((
void
*
)
&
RC
,
0
,
sizeof
(
RC
));
/* Read RC configuration file */
RCConfig
();
NB_eNB_INST
=
RC
.
nb_inst
;
NB_RU
=
RC
.
nb_RU
;
printf
(
"Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d
\n
"
,
NB_eNB_INST
,
RC
.
nb_L1_inst
,
NB_RU
);
}
}
else
if
(
UE_flag
==
1
&&
(
!
(
CONFIG_ISFLAGSET
(
CONFIG_NOOOPT
)))
)
{
// Here the configuration file is the XER encoded UE capabilities
// Read it in and store in asn1c data structures
sprintf
(
uecap_xer
,
"%stargets/PROJECTS/GENERIC-LTE-EPC/CONF/UE_config.xml"
,
getenv
(
"OPENAIR_HOME"
));
printf
(
"%s
\n
"
,
uecap_xer
);
uecap_xer_in
=
1
;
}
/* UE with config file */
}
}
...
...
@@ -757,9 +619,8 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
}
void
init_openair0
(
void
);
void
init_openair0
()
{
void
init_openair0
(
void
)
{
int
card
;
int
i
;
...
...
@@ -799,16 +660,14 @@ void init_openair0() {
}
if
(
frame_parms
[
0
]
->
frame_type
==
TDD
)
openair0_cfg
[
card
].
duplex_mode
=
duplex_mode_TDD
;
else
//FDD
openair0_cfg
[
card
].
duplex_mode
=
duplex_mode_FDD
;
printf
(
"HW: Configuring card %d, nb_antennas_tx/rx %d/%d
\n
"
,
card
,
((
UE_flag
==
0
)
?
RC
.
eNB
[
0
][
0
]
->
frame_parms
.
nb_antennas_tx
:
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
nb_antennas_tx
)
,
((
UE_flag
==
0
)
?
RC
.
eNB
[
0
][
0
]
->
frame_parms
.
nb_antennas_rx
:
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
nb_antennas_rx
)
);
RC
.
eNB
[
0
][
0
]
->
frame_parms
.
nb_antennas_tx
,
RC
.
eNB
[
0
][
0
]
->
frame_parms
.
nb_antennas_rx
);
openair0_cfg
[
card
].
Mod_id
=
0
;
openair0_cfg
[
card
].
num_rb_dl
=
frame_parms
[
0
]
->
N_RB_DL
;
...
...
@@ -816,29 +675,25 @@ void init_openair0() {
openair0_cfg
[
card
].
clock_source
=
clock_source
;
openair0_cfg
[
card
].
tx_num_channels
=
min
(
2
,
((
UE_flag
==
0
)
?
RC
.
eNB
[
0
][
0
]
->
frame_parms
.
nb_antennas_tx
:
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
nb_antennas_tx
)
);
openair0_cfg
[
card
].
rx_num_channels
=
min
(
2
,
((
UE_flag
==
0
)
?
RC
.
eNB
[
0
][
0
]
->
frame_parms
.
nb_antennas_rx
:
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
nb_antennas_rx
)
);
openair0_cfg
[
card
].
tx_num_channels
=
min
(
2
,
RC
.
eNB
[
0
][
0
]
->
frame_parms
.
nb_antennas_tx
);
openair0_cfg
[
card
].
rx_num_channels
=
min
(
2
,
RC
.
eNB
[
0
][
0
]
->
frame_parms
.
nb_antennas_rx
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
(
i
<
openair0_cfg
[
card
].
tx_num_channels
)
openair0_cfg
[
card
].
tx_freq
[
i
]
=
(
UE_flag
==
0
)
?
downlink_frequency
[
0
][
i
]
:
downlink_frequency
[
0
][
i
]
+
uplink_frequency_offset
[
0
][
i
]
;
openair0_cfg
[
card
].
tx_freq
[
i
]
=
downlink_frequency
[
0
][
i
]
;
else
openair0_cfg
[
card
].
tx_freq
[
i
]
=
0
.
0
;
if
(
i
<
openair0_cfg
[
card
].
rx_num_channels
)
openair0_cfg
[
card
].
rx_freq
[
i
]
=
(
UE_flag
==
0
)
?
downlink_frequency
[
0
][
i
]
+
uplink_frequency_offset
[
0
][
i
]
:
downlink_frequency
[
0
][
i
]
;
openair0_cfg
[
card
].
rx_freq
[
i
]
=
downlink_frequency
[
0
][
i
]
+
uplink_frequency_offset
[
0
][
i
]
;
else
openair0_cfg
[
card
].
rx_freq
[
i
]
=
0
.
0
;
openair0_cfg
[
card
].
autocal
[
i
]
=
1
;
openair0_cfg
[
card
].
tx_gain
[
i
]
=
tx_gain
[
0
][
i
];
if
(
UE_flag
==
0
)
{
openair0_cfg
[
card
].
rx_gain
[
i
]
=
RC
.
eNB
[
0
][
0
]
->
rx_total_gain_dB
;
}
else
{
openair0_cfg
[
card
].
rx_gain
[
i
]
=
PHY_vars_UE_g
[
0
][
0
]
->
rx_total_gain_dB
-
rx_gain_off
;
}
openair0_cfg
[
card
].
rx_gain
[
i
]
=
RC
.
eNB
[
0
][
0
]
->
rx_total_gain_dB
;
openair0_cfg
[
card
].
configFilename
=
rf_config_file
;
printf
(
"Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f
\n
"
,
...
...
@@ -847,7 +702,7 @@ void init_openair0() {
openair0_cfg
[
card
].
tx_freq
[
i
],
openair0_cfg
[
card
].
rx_freq
[
i
]);
}
}
}
/* for loop on cards */
}
...
...
@@ -995,7 +850,6 @@ int restart_L1L2(module_id_t enb_id)
msg_p
=
itti_alloc_new_message
(
TASK_ENB_APP
,
RRC_CONFIGURATION_REQ
);
RRC_CONFIGURATION_REQ
(
msg_p
)
=
RC
.
rrc
[
enb_id
]
->
configuration
;
itti_send_msg_to_task
(
TASK_RRC_ENB
,
ENB_MODULE_ID_TO_INSTANCE
(
enb_id
),
msg_p
);
/* TODO XForms might need to be restarted, but it is currently (09/02/18)
* broken, so we cannot test it */
...
...
@@ -1016,7 +870,7 @@ int restart_L1L2(module_id_t enb_id)
}
#endif
static
inline
void
wait_nfapi_init
(
char
*
thread_name
)
{
static
void
wait_nfapi_init
(
char
*
thread_name
)
{
printf
(
"waiting for NFAPI PNF connection and population of global structure (%s)
\n
"
,
thread_name
);
pthread_mutex_lock
(
&
nfapi_sync_mutex
);
...
...
@@ -1038,9 +892,6 @@ int main( int argc, char **argv )
int
CC_id
;
int
ru_id
;
uint8_t
abstraction_flag
=
0
;
uint8_t
beta_ACK
=
0
,
beta_RI
=
0
,
beta_CQI
=
2
;
#if defined (XFORMS)
int
ret
;
#endif
...
...
@@ -1055,8 +906,6 @@ int main( int argc, char **argv )
setvbuf
(
stderr
,
NULL
,
_IONBF
,
0
);
#endif
PHY_VARS_UE
*
UE
[
MAX_NUM_CCs
];
mode
=
normal_txrx
;
memset
(
&
openair0_cfg
[
0
],
0
,
sizeof
(
openair0_config_t
)
*
MAX_CARDS
);
...
...
@@ -1064,16 +913,12 @@ int main( int argc, char **argv )
set_latency_target
();
// set default parameters
//if (UE_flag == 1) set_default_frame_parms(frame_parms);
logInit
();
printf
(
"Reading in command-line options
\n
"
);
get_options
();
if
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
)
&&
UE_flag
==
0
)
{
if
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
)
)
{
fprintf
(
stderr
,
"Getting configuration failed
\n
"
);
exit
(
-
1
);
}
...
...
@@ -1088,32 +933,10 @@ int main( int argc, char **argv )
//randominit (0);
set_taus_seed
(
0
);
if
(
UE_flag
==
1
)
{
printf
(
"configuring for UE
\n
"
);
set_comp_log
(
HW
,
LOG_DEBUG
,
LOG_HIGH
,
1
);
set_comp_log
(
PHY
,
LOG_INFO
,
LOG_HIGH
,
1
);
set_comp_log
(
MAC
,
LOG_INFO
,
LOG_HIGH
,
1
);
set_comp_log
(
RLC
,
LOG_INFO
,
LOG_HIGH
|
FLAG_THREAD
,
1
);
set_comp_log
(
PDCP
,
LOG_INFO
,
LOG_HIGH
,
1
);
set_comp_log
(
OTG
,
LOG_INFO
,
LOG_HIGH
,
1
);
set_comp_log
(
RRC
,
LOG_INFO
,
LOG_HIGH
,
1
);
#if defined(ENABLE_ITTI)
set_comp_log
(
EMU
,
LOG_INFO
,
LOG_MED
,
1
);
# if defined(ENABLE_USE_MME)
set_comp_log
(
NAS
,
LOG_INFO
,
LOG_HIGH
,
1
);
# endif
#endif
}
else
{
printf
(
"configuring for RAU/RRU
\n
"
);
printf
(
"configuring for RAU/RRU
\n
"
);
}
if
(
ouput_vcd
)
{
if
(
UE_flag
==
1
)
VCD_SIGNAL_DUMPER_INIT
(
"/tmp/openair_dump_UE.vcd"
);
else
VCD_SIGNAL_DUMPER_INIT
(
"/tmp/openair_dump_eNB.vcd"
);
}
...
...
@@ -1123,12 +946,7 @@ int main( int argc, char **argv )
cpuf
=
get_cpu_freq_GHz
();
#if defined(ENABLE_ITTI)
if
(
UE_flag
==
1
)
{
log_set_instance_type
(
LOG_INSTANCE_UE
);
}
else
{
log_set_instance_type
(
LOG_INSTANCE_ENB
);
}
log_set_instance_type
(
LOG_INSTANCE_ENB
);
printf
(
"ITTI init
\n
"
);
itti_init
(
TASK_MAX
,
THREAD_MAX
,
MESSAGES_ID_MAX
,
tasks_info
,
messages_info
,
messages_definition_xml
,
itti_dump_file
);
...
...
@@ -1172,82 +990,11 @@ int main( int argc, char **argv )
LOG_I
(
HW
,
"Version: %s
\n
"
,
PACKAGE_VERSION
);
// init the parameters
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
if
(
UE_flag
==
1
)
{
frame_parms
[
CC_id
]
->
nb_antennas_tx
=
nb_antenna_tx
;
frame_parms
[
CC_id
]
->
nb_antennas_rx
=
nb_antenna_rx
;
frame_parms
[
CC_id
]
->
nb_antenna_ports_eNB
=
1
;
//initial value overwritten by initial sync later
}
}
printf
(
"Before CC
\n
"
);
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
if
(
UE_flag
==
1
)
{
NB_UE_INST
=
1
;
NB_INST
=
1
;
PHY_vars_UE_g
=
malloc
(
sizeof
(
PHY_VARS_UE
**
));
PHY_vars_UE_g
[
0
]
=
malloc
(
sizeof
(
PHY_VARS_UE
*
)
*
MAX_NUM_CCs
);
PHY_vars_UE_g
[
0
][
CC_id
]
=
init_ue_vars
(
frame_parms
[
CC_id
],
0
,
abstraction_flag
);
UE
[
CC_id
]
=
PHY_vars_UE_g
[
0
][
CC_id
];
printf
(
"PHY_vars_UE_g[0][%d] = %p
\n
"
,
CC_id
,
UE
[
CC_id
]);
if
(
phy_test
==
1
)
UE
[
CC_id
]
->
mac_enabled
=
0
;
else
UE
[
CC_id
]
->
mac_enabled
=
1
;
if
(
UE
[
CC_id
]
->
mac_enabled
==
0
)
{
//set default UL parameters for testing mode
for
(
i
=
0
;
i
<
NUMBER_OF_CONNECTED_eNB_MAX
;
i
++
)
{
UE
[
CC_id
]
->
pusch_config_dedicated
[
i
].
betaOffset_ACK_Index
=
beta_ACK
;
UE
[
CC_id
]
->
pusch_config_dedicated
[
i
].
betaOffset_RI_Index
=
beta_RI
;
UE
[
CC_id
]
->
pusch_config_dedicated
[
i
].
betaOffset_CQI_Index
=
beta_CQI
;
UE
[
CC_id
]
->
scheduling_request_config
[
i
].
sr_PUCCH_ResourceIndex
=
0
;
UE
[
CC_id
]
->
scheduling_request_config
[
i
].
sr_ConfigIndex
=
7
+
(
0
%
3
);
UE
[
CC_id
]
->
scheduling_request_config
[
i
].
dsr_TransMax
=
sr_n4
;
}
}
UE
[
CC_id
]
->
UE_scan
=
UE_scan
;
UE
[
CC_id
]
->
UE_scan_carrier
=
UE_scan_carrier
;
UE
[
CC_id
]
->
mode
=
mode
;
printf
(
"UE[%d]->mode = %d
\n
"
,
CC_id
,
mode
);
if
(
UE
[
CC_id
]
->
mac_enabled
==
1
)
{
UE
[
CC_id
]
->
pdcch_vars
[
0
][
0
]
->
crnti
=
0x1234
;
UE
[
CC_id
]
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1234
;
}
else
{
UE
[
CC_id
]
->
pdcch_vars
[
0
][
0
]
->
crnti
=
0x1235
;
UE
[
CC_id
]
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1235
;
}
UE
[
CC_id
]
->
rx_total_gain_dB
=
(
int
)
rx_gain
[
CC_id
][
0
]
+
rx_gain_off
;
UE
[
CC_id
]
->
tx_power_max_dBm
=
tx_max_power
[
CC_id
];
if
(
frame_parms
[
CC_id
]
->
frame_type
==
FDD
)
{
UE
[
CC_id
]
->
N_TA_offset
=
0
;
}
else
{
if
(
frame_parms
[
CC_id
]
->
N_RB_DL
==
100
)
UE
[
CC_id
]
->
N_TA_offset
=
624
;
else
if
(
frame_parms
[
CC_id
]
->
N_RB_DL
==
50
)
UE
[
CC_id
]
->
N_TA_offset
=
624
/
2
;
else
if
(
frame_parms
[
CC_id
]
->
N_RB_DL
==
25
)
UE
[
CC_id
]
->
N_TA_offset
=
624
/
4
;
}
init_openair0
();
}
}
printf
(
"Runtime table
\n
"
);
fill_modeled_runtime_table
(
runtime_phy_rx
,
runtime_phy_tx
);
cpuf
=
get_cpu_freq_GHz
();
...
...
@@ -1296,22 +1043,13 @@ int main( int argc, char **argv )
#if defined(ENABLE_ITTI)
if
((
UE_flag
==
1
)
||
(
RC
.
nb_inst
>
0
))
{
if
(
RC
.
nb_inst
>
0
)
{
// don't create if node doesn't connect to RRC/S1/GTP
if
(
UE_flag
==
0
)
{
if
(
create_tasks
(
1
)
<
0
)
{
printf
(
"cannot create ITTI tasks
\n
"
);
exit
(
-
1
);
// need a softer mode
}
}
else
{
if
(
create_tasks_ue
(
1
)
<
0
)
{
printf
(
"cannot create ITTI tasks
\n
"
);
exit
(
-
1
);
// need a softer mode
}
}
printf
(
"ITTI tasks created
\n
"
);
}
else
{
...
...
@@ -1343,7 +1081,6 @@ int main( int argc, char **argv )
if
(
do_forms
==
1
)
{
fl_initialize
(
&
argc
,
argv
,
NULL
,
0
,
0
);
if
(
UE_flag
==
0
)
{
form_stats_l2
=
create_form_stats_form
();
fl_show_form
(
form_stats_l2
->
stats_form
,
FL_PLACE_HOTSPOT
,
FL_FULLBORDER
,
"l2 stats"
);
form_stats
=
create_form_stats_form
();
...
...
@@ -1364,25 +1101,6 @@ int main( int argc, char **argv )
}
}
// CC_id
}
// UE_id
}
else
{
form_stats
=
create_form_stats_form
();
fl_show_form
(
form_stats
->
stats_form
,
FL_PLACE_HOTSPOT
,
FL_FULLBORDER
,
"stats"
);
UE_id
=
0
;
form_ue
[
UE_id
]
=
create_lte_phy_scope_ue
();
sprintf
(
title
,
"LTE DL SCOPE UE"
);
fl_show_form
(
form_ue
[
UE_id
]
->
lte_phy_scope_ue
,
FL_PLACE_HOTSPOT
,
FL_FULLBORDER
,
title
);
/*
if (openair_daq_vars.use_ia_receiver) {
fl_set_button(form_ue[UE_id]->button_0,1);
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
} else {
fl_set_button(form_ue[UE_id]->button_0,0);
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
}*/
fl_set_button
(
form_ue
[
UE_id
]
->
button_0
,
0
);
fl_set_object_label
(
form_ue
[
UE_id
]
->
button_0
,
"IA Receiver OFF"
);
}
ret
=
pthread_create
(
&
forms_thread
,
NULL
,
scope_thread
,
NULL
);
...
...
@@ -1427,23 +1145,7 @@ int main( int argc, char **argv )
printf
(
"START MAIN THREADS
\n
"
);
// start the main threads
if
(
UE_flag
==
1
)
{
int
eMBMS_active
=
0
;
init_UE
(
1
,
eMBMS_active
,
uecap_xer_in
,
0
);
if
(
phy_test
==
0
)
{
printf
(
"Filling UE band info
\n
"
);
fill_ue_band_info
();
dl_phy_sync_success
(
0
,
0
,
0
,
1
);
}
number_of_cards
=
1
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
PHY_vars_UE_g
[
0
][
CC_id
]
->
rf_map
.
card
=
0
;
PHY_vars_UE_g
[
0
][
CC_id
]
->
rf_map
.
chain
=
CC_id
+
chain_offset
;
}
}
else
{
number_of_cards
=
1
;
printf
(
"RC.nb_L1_inst:%d
\n
"
,
RC
.
nb_L1_inst
);
if
(
RC
.
nb_L1_inst
>
0
)
{
...
...
@@ -1490,42 +1192,10 @@ int main( int argc, char **argv )
}
printf
(
"ALL RUs ready - ALL eNBs ready
\n
"
);
}
// connect the TX/RX buffers
if
(
UE_flag
==
1
)
{
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
#ifdef OAI_USRP
UE
[
CC_id
]
->
hw_timing_advance
=
timing_advance
;
#else
UE
[
CC_id
]
->
hw_timing_advance
=
160
;
#endif
}
if
(
setup_ue_buffers
(
UE
,
&
openair0_cfg
[
0
])
!=
0
)
{
printf
(
"Error setting up eNB buffer
\n
"
);
exit
(
-
1
);
}
if
(
input_fd
)
{
printf
(
"Reading in from file to antenna buffer %d
\n
"
,
0
);
if
(
fread
(
UE
[
0
]
->
common_vars
.
rxdata
[
0
],
sizeof
(
int32_t
),
frame_parms
[
0
]
->
samples_per_tti
*
10
,
input_fd
)
!=
frame_parms
[
0
]
->
samples_per_tti
*
10
)
printf
(
"error reading from file
\n
"
);
}
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
}
else
{
printf
(
"eNB mode
\n
"
);
}
printf
(
"Sending sync to all threads
\n
"
);
...
...
@@ -1564,10 +1234,6 @@ int main( int argc, char **argv )
fl_hide_form
(
form_stats
->
stats_form
);
fl_free_form
(
form_stats
->
stats_form
);
if
(
UE_flag
==
1
)
{
fl_hide_form
(
form_ue
[
0
]
->
lte_phy_scope_ue
);
fl_free_form
(
form_ue
[
0
]
->
lte_phy_scope_ue
);
}
else
{
fl_hide_form
(
form_stats_l2
->
stats_form
);
fl_free_form
(
form_stats_l2
->
stats_form
);
...
...
@@ -1577,7 +1243,6 @@ int main( int argc, char **argv )
fl_free_form
(
form_enb
[
CC_id
][
UE_id
]
->
lte_phy_scope_enb
);
}
}
}
}
#endif
...
...
@@ -1585,8 +1250,6 @@ int main( int argc, char **argv )
printf
(
"stopping MODEM threads
\n
"
);
// cleanup
if
(
UE_flag
==
1
)
{
}
else
{
stop_eNB
(
NB_eNB_INST
);
stop_RU
(
NB_RU
);
/* release memory used by the RU/eNB threads (incomplete), after all
...
...
@@ -1601,7 +1264,6 @@ int main( int argc, char **argv )
phy_free_RU
(
RC
.
ru
[
inst
]);
}
free_lte_top
();
}
pthread_cond_destroy
(
&
sync_cond
);
...
...
@@ -1613,11 +1275,7 @@ int main( int argc, char **argv )
pthread_mutex_destroy
(
&
ue_pf_po_mutex
);
// *** Handle per CC_id openair0
if
(
UE_flag
==
1
)
{
if
(
PHY_vars_UE_g
[
0
][
0
]
->
rfdevice
.
trx_end_func
)
PHY_vars_UE_g
[
0
][
0
]
->
rfdevice
.
trx_end_func
(
&
PHY_vars_UE_g
[
0
][
0
]
->
rfdevice
);
}
else
{
for
(
ru_id
=
0
;
ru_id
<
NB_RU
;
ru_id
++
)
{
if
(
RC
.
ru
[
ru_id
]
->
rfdevice
.
trx_end_func
)
RC
.
ru
[
ru_id
]
->
rfdevice
.
trx_end_func
(
&
RC
.
ru
[
ru_id
]
->
rfdevice
);
...
...
@@ -1625,7 +1283,6 @@ int main( int argc, char **argv )
RC
.
ru
[
ru_id
]
->
ifdevice
.
trx_end_func
(
&
RC
.
ru
[
ru_id
]
->
ifdevice
);
}
}
if
(
ouput_vcd
)
VCD_SIGNAL_DUMPER_CLOSE
();
...
...
targets/RT/USER/lte-softmodem.h
View file @
b04f3b54
...
...
@@ -129,10 +129,10 @@
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:
0,
TYPE_UINT8, 0}, \
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:
25,
TYPE_UINT8, 0}, \
}
#define DEFAULT_DLF 2680000000
extern
int16_t
dlsch_demod_shift
;
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters common to eNodeB and UE */
...
...
@@ -155,12 +155,11 @@ extern int16_t dlsch_demod_shift;
{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:
2680000000
, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:
DEFAULT_DLF
, TYPE_UINT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"U" , CONFIG_HLP_UE, PARAMFLAG_BOOL, i8ptr:&UE_flag, defintval:0, TYPE_INT8, 0}, \
{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"W" , CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \
...
...
targets/RT/USER/lte-uesoftmodem.c
0 → 100644
View file @
b04f3b54
/*
* 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 lte-enb.c
* \brief Top-level threads for eNodeB
* \author R. Knopp, F. Kaltenberger, Navid Nikaein
* \date 2012
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
* \note
* \warning
*/
#define _GNU_SOURCE
/* See feature_test_macros(7) */
#include <sched.h>
#include "T.h"
#include "rt_wrapper.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
#include "assertions.h"
#include "msc.h"
#include "PHY/types.h"
#include "PHY/defs.h"
#include "common/ran_context.h"
#include "common/config/config_userapi.h"
#include "common/utils/load_module_shlib.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
#include "../../ARCH/COMMON/common_lib.h"
#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
#include "PHY/vars.h"
#include "SCHED/vars.h"
#include "LAYER2/MAC/vars.h"
#include "../../SIMU/USER/init_lte.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/vars.h"
#include "LAYER2/MAC/proto.h"
#include "RRC/LITE/vars.h"
#include "PHY_INTERFACE/vars.h"
#ifdef SMBV
#include "PHY/TOOLS/smbv.h"
unsigned
short
config_frames
[
4
]
=
{
2
,
9
,
11
,
13
};
#endif
#include "UTIL/LOG/log_extern.h"
#include "UTIL/OTG/otg_tx.h"
#include "UTIL/OTG/otg_externs.h"
#include "UTIL/MATH/oml.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "enb_config.h"
//#include "PHY/TOOLS/time_meas.h"
#ifndef OPENAIR2
#include "UTIL/OTG/otg_vars.h"
#endif
#if defined(ENABLE_ITTI)
#include "intertask_interface_init.h"
#include "create_tasks.h"
#endif
#include "system.h"
#ifdef XFORMS
#include "PHY/TOOLS/lte_phy_scope.h"
#include "stats.h"
#endif
#include "lte-softmodem.h"
/* temporary compilation wokaround (UE/eNB split */
uint16_t
sf_ahead
;
#ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
// at eNB 0, an UL scope for every UE
FD_lte_phy_scope_ue
*
form_ue
[
NUMBER_OF_UE_MAX
];
FD_lte_phy_scope_enb
*
form_enb
[
MAX_NUM_CCs
][
NUMBER_OF_UE_MAX
];
FD_stats_form
*
form_stats
=
NULL
,
*
form_stats_l2
=
NULL
;
char
title
[
255
];
unsigned
char
scope_enb_num_ue
=
2
;
static
pthread_t
forms_thread
;
//xforms
#endif //XFORMS
pthread_cond_t
sync_cond
;
pthread_mutex_t
sync_mutex
;
int
sync_var
=-
1
;
//!< protected by mutex \ref sync_mutex.
int
config_sync_var
=-
1
;
uint16_t
runtime_phy_rx
[
29
][
6
];
// SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
uint16_t
runtime_phy_tx
[
29
][
6
];
// SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
#if defined(ENABLE_ITTI)
volatile
int
start_eNB
=
0
;
volatile
int
start_UE
=
0
;
#endif
volatile
int
oai_exit
=
0
;
static
clock_source_t
clock_source
=
internal
;
static
int
wait_for_sync
=
0
;
unsigned
int
mmapped_dma
=
0
;
int
single_thread_flag
=
1
;
static
int8_t
threequarter_fs
=
0
;
uint32_t
downlink_frequency
[
MAX_NUM_CCs
][
4
];
int32_t
uplink_frequency_offset
[
MAX_NUM_CCs
][
4
];
#if defined(ENABLE_ITTI)
static
char
*
itti_dump_file
=
NULL
;
#endif
int
UE_scan
=
1
;
int
UE_scan_carrier
=
0
;
runmode_t
mode
=
normal_txrx
;
FILE
*
input_fd
=
NULL
;
#if MAX_NUM_CCs == 1
rx_gain_t
rx_gain_mode
[
MAX_NUM_CCs
][
4
]
=
{{
max_gain
,
max_gain
,
max_gain
,
max_gain
}};
double
tx_gain
[
MAX_NUM_CCs
][
4
]
=
{{
20
,
0
,
0
,
0
}};
double
rx_gain
[
MAX_NUM_CCs
][
4
]
=
{{
110
,
0
,
0
,
0
}};
#else
rx_gain_t
rx_gain_mode
[
MAX_NUM_CCs
][
4
]
=
{{
max_gain
,
max_gain
,
max_gain
,
max_gain
},{
max_gain
,
max_gain
,
max_gain
,
max_gain
}};
double
tx_gain
[
MAX_NUM_CCs
][
4
]
=
{{
20
,
0
,
0
,
0
},{
20
,
0
,
0
,
0
}};
double
rx_gain
[
MAX_NUM_CCs
][
4
]
=
{{
110
,
0
,
0
,
0
},{
20
,
0
,
0
,
0
}};
#endif
double
rx_gain_off
=
0
.
0
;
double
sample_rate
=
30.72e6
;
double
bw
=
10.0e6
;
static
int
tx_max_power
[
MAX_NUM_CCs
];
/* = {0,0}*/
;
char
rf_config_file
[
1024
];
int
chain_offset
=
0
;
int
phy_test
=
0
;
uint8_t
usim_test
=
0
;
uint8_t
dci_Format
=
0
;
uint8_t
agregation_Level
=
0xFF
;
uint8_t
nb_antenna_tx
=
1
;
uint8_t
nb_antenna_rx
=
1
;
char
ref
[
128
]
=
"internal"
;
char
channels
[
128
]
=
"0"
;
int
rx_input_level_dBm
;
#ifdef XFORMS
extern
int
otg_enabled
;
static
char
do_forms
=
0
;
#else
int
otg_enabled
;
#endif
//int number_of_cards = 1;
static
LTE_DL_FRAME_PARMS
*
frame_parms
[
MAX_NUM_CCs
];
uint32_t
target_dl_mcs
=
28
;
//maximum allowed mcs
uint32_t
target_ul_mcs
=
20
;
uint32_t
timing_advance
=
0
;
uint8_t
exit_missed_slots
=
1
;
uint64_t
num_missed_slots
=
0
;
// counter for the number of missed slots
extern
void
reset_opp_meas
(
void
);
extern
void
print_opp_meas
(
void
);
extern
PHY_VARS_UE
*
init_ue_vars
(
LTE_DL_FRAME_PARMS
*
frame_parms
,
uint8_t
UE_id
,
uint8_t
abstraction_flag
);
int
transmission_mode
=
1
;
/* struct for ethernet specific parameters given in eNB conf file */
eth_params_t
*
eth_params
;
openair0_config_t
openair0_cfg
[
MAX_CARDS
];
double
cpuf
;
extern
char
uecap_xer
[
1024
];
char
uecap_xer_in
=
0
;
int
oaisim_flag
=
0
;
threads_t
threads
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
};
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
* this is very hackish - find a proper solution
*/
uint8_t
abstraction_flag
=
0
;
/* forward declarations */
void
set_default_frame_parms
(
LTE_DL_FRAME_PARMS
*
frame_parms
[
MAX_NUM_CCs
]);
/*---------------------BMC: timespec helpers -----------------------------*/
struct
timespec
min_diff_time
=
{
.
tv_sec
=
0
,
.
tv_nsec
=
0
};
struct
timespec
max_diff_time
=
{
.
tv_sec
=
0
,
.
tv_nsec
=
0
};
struct
timespec
clock_difftime
(
struct
timespec
start
,
struct
timespec
end
)
{
struct
timespec
temp
;
if
((
end
.
tv_nsec
-
start
.
tv_nsec
)
<
0
)
{
temp
.
tv_sec
=
end
.
tv_sec
-
start
.
tv_sec
-
1
;
temp
.
tv_nsec
=
1000000000
+
end
.
tv_nsec
-
start
.
tv_nsec
;
}
else
{
temp
.
tv_sec
=
end
.
tv_sec
-
start
.
tv_sec
;
temp
.
tv_nsec
=
end
.
tv_nsec
-
start
.
tv_nsec
;
}
return
temp
;
}
void
print_difftimes
(
void
)
{
#ifdef DEBUG
printf
(
"difftimes min = %lu ns ; max = %lu ns
\n
"
,
min_diff_time
.
tv_nsec
,
max_diff_time
.
tv_nsec
);
#else
LOG_I
(
HW
,
"difftimes min = %lu ns ; max = %lu ns
\n
"
,
min_diff_time
.
tv_nsec
,
max_diff_time
.
tv_nsec
);
#endif
}
void
update_difftimes
(
struct
timespec
start
,
struct
timespec
end
)
{
struct
timespec
diff_time
=
{
.
tv_sec
=
0
,
.
tv_nsec
=
0
};
int
changed
=
0
;
diff_time
=
clock_difftime
(
start
,
end
);
if
((
min_diff_time
.
tv_nsec
==
0
)
||
(
diff_time
.
tv_nsec
<
min_diff_time
.
tv_nsec
))
{
min_diff_time
.
tv_nsec
=
diff_time
.
tv_nsec
;
changed
=
1
;
}
if
((
max_diff_time
.
tv_nsec
==
0
)
||
(
diff_time
.
tv_nsec
>
max_diff_time
.
tv_nsec
))
{
max_diff_time
.
tv_nsec
=
diff_time
.
tv_nsec
;
changed
=
1
;
}
#if 1
if
(
changed
)
print_difftimes
();
#endif
}
/*------------------------------------------------------------------------*/
unsigned
int
build_rflocal
(
int
txi
,
int
txq
,
int
rxi
,
int
rxq
)
{
return
(
txi
+
(
txq
<<
6
)
+
(
rxi
<<
12
)
+
(
rxq
<<
18
));
}
unsigned
int
build_rfdc
(
int
dcoff_i_rxfe
,
int
dcoff_q_rxfe
)
{
return
(
dcoff_i_rxfe
+
(
dcoff_q_rxfe
<<
8
));
}
#if !defined(ENABLE_ITTI)
void
signal_handler
(
int
sig
)
{
void
*
array
[
10
];
size_t
size
;
if
(
sig
==
SIGSEGV
)
{
// get void*'s for all entries on the stack
size
=
backtrace
(
array
,
10
);
// print out all the frames to stderr
fprintf
(
stderr
,
"Error: signal %d:
\n
"
,
sig
);
backtrace_symbols_fd
(
array
,
size
,
2
);
exit
(
-
1
);
}
else
{
printf
(
"trying to exit gracefully...
\n
"
);
oai_exit
=
1
;
}
}
#endif
#define KNRM "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KBLU "\x1B[34m"
#define RESET "\033[0m"
void
exit_fun
(
const
char
*
s
)
{
int
CC_id
;
if
(
s
!=
NULL
)
{
printf
(
"%s %s() Exiting OAI softmodem: %s
\n
"
,
__FILE__
,
__FUNCTION__
,
s
);
}
oai_exit
=
1
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
if
(
PHY_vars_UE_g
[
0
][
CC_id
]
->
rfdevice
.
trx_end_func
)
PHY_vars_UE_g
[
0
][
CC_id
]
->
rfdevice
.
trx_end_func
(
&
PHY_vars_UE_g
[
0
][
CC_id
]
->
rfdevice
);
}
#if defined(ENABLE_ITTI)
sleep
(
1
);
//allow lte-softmodem threads to exit first
itti_terminate_tasks
(
TASK_UNKNOWN
);
#endif
}
#ifdef XFORMS
void
reset_stats
(
FL_OBJECT
*
button
,
long
arg
)
{
int
i
,
j
,
k
;
PHY_VARS_eNB
*
phy_vars_eNB
=
RC
.
eNB
[
0
][
0
];
for
(
i
=
0
;
i
<
NUMBER_OF_UE_MAX
;
i
++
)
{
for
(
k
=
0
;
k
<
8
;
k
++
)
{
//harq_processes
for
(
j
=
0
;
j
<
phy_vars_eNB
->
dlsch
[
i
][
0
]
->
Mlimit
;
j
++
)
{
phy_vars_eNB
->
UE_stats
[
i
].
dlsch_NAK
[
k
][
j
]
=
0
;
phy_vars_eNB
->
UE_stats
[
i
].
dlsch_ACK
[
k
][
j
]
=
0
;
phy_vars_eNB
->
UE_stats
[
i
].
dlsch_trials
[
k
][
j
]
=
0
;
}
phy_vars_eNB
->
UE_stats
[
i
].
dlsch_l2_errors
[
k
]
=
0
;
phy_vars_eNB
->
UE_stats
[
i
].
ulsch_errors
[
k
]
=
0
;
phy_vars_eNB
->
UE_stats
[
i
].
ulsch_consecutive_errors
=
0
;
phy_vars_eNB
->
UE_stats
[
i
].
dlsch_sliding_cnt
=
0
;
phy_vars_eNB
->
UE_stats
[
i
].
dlsch_NAK_round0
=
0
;
phy_vars_eNB
->
UE_stats
[
i
].
dlsch_mcs_offset
=
0
;
}
}
}
static
void
*
scope_thread
(
void
*
arg
)
{
char
stats_buffer
[
16384
];
# ifdef ENABLE_XFORMS_WRITE_STATS
FILE
*
UE_stats
,
*
eNB_stats
;
# endif
struct
sched_param
sched_param
;
sched_param
.
sched_priority
=
sched_get_priority_min
(
SCHED_FIFO
)
+
1
;
sched_setscheduler
(
0
,
SCHED_FIFO
,
&
sched_param
);
printf
(
"Scope thread has priority %d
\n
"
,
sched_param
.
sched_priority
);
# ifdef ENABLE_XFORMS_WRITE_STATS
UE_stats
=
fopen
(
"UE_stats.txt"
,
"w"
);
#endif
while
(
!
oai_exit
)
{
dump_ue_stats
(
PHY_vars_UE_g
[
0
][
0
],
&
PHY_vars_UE_g
[
0
][
0
]
->
proc
.
proc_rxtx
[
0
],
stats_buffer
,
0
,
mode
,
rx_input_level_dBm
);
//fl_set_object_label(form_stats->stats_text, stats_buffer);
fl_clear_browser
(
form_stats
->
stats_text
);
fl_add_browser_line
(
form_stats
->
stats_text
,
stats_buffer
);
phy_scope_UE
(
form_ue
[
0
],
PHY_vars_UE_g
[
0
][
0
],
0
,
0
,
7
);
// printf("%s",stats_buffer);
}
# ifdef ENABLE_XFORMS_WRITE_STATS
if
(
UE_stats
)
{
rewind
(
UE_stats
);
fwrite
(
stats_buffer
,
1
,
len
,
UE_stats
);
fclose
(
UE_stats
);
}
# endif
pthread_exit
((
void
*
)
arg
);
}
#endif
#if defined(ENABLE_ITTI)
void
*
l2l1_task
(
void
*
arg
)
{
MessageDef
*
message_p
=
NULL
;
int
result
;
itti_set_task_real_time
(
TASK_L2L1
);
itti_mark_task_ready
(
TASK_L2L1
);
do
{
// Wait for a message
itti_receive_msg
(
TASK_L2L1
,
&
message_p
);
switch
(
ITTI_MSG_ID
(
message_p
))
{
case
TERMINATE_MESSAGE
:
oai_exit
=
1
;
itti_exit_task
();
break
;
case
ACTIVATE_MESSAGE
:
start_UE
=
1
;
break
;
case
DEACTIVATE_MESSAGE
:
start_UE
=
0
;
break
;
case
MESSAGE_TEST
:
LOG_I
(
EMU
,
"Received %s
\n
"
,
ITTI_MSG_NAME
(
message_p
));
break
;
default:
LOG_E
(
EMU
,
"Received unexpected message %s
\n
"
,
ITTI_MSG_NAME
(
message_p
));
break
;
}
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
message_p
),
message_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
}
while
(
!
oai_exit
);
return
NULL
;
}
#endif
static
void
get_options
(
void
)
{
int
CC_id
;
int
tddflag
,
nonbiotflag
;
char
*
loopfile
=
NULL
;
int
dumpframe
;
uint32_t
online_log_messages
;
uint32_t
glog_level
,
glog_verbosity
;
uint32_t
start_telnetsrv
;
paramdef_t
cmdline_params
[]
=
CMDLINE_PARAMS_DESC
;
paramdef_t
cmdline_logparams
[]
=
CMDLINE_LOGPARAMS_DESC
;
set_default_frame_parms
(
frame_parms
);
config_process_cmdline
(
cmdline_params
,
sizeof
(
cmdline_params
)
/
sizeof
(
paramdef_t
),
NULL
);
if
(
strlen
(
in_path
)
>
0
)
{
opt_type
=
OPT_PCAP
;
opt_enabled
=
1
;
printf
(
"Enabling OPT for PCAP with the following file %s
\n
"
,
in_path
);
}
if
(
strlen
(
in_ip
)
>
0
)
{
opt_enabled
=
1
;
opt_type
=
OPT_WIRESHARK
;
printf
(
"Enabling OPT for wireshark for local interface"
);
}
config_process_cmdline
(
cmdline_logparams
,
sizeof
(
cmdline_logparams
)
/
sizeof
(
paramdef_t
),
NULL
);
if
(
config_isparamset
(
cmdline_logparams
,
CMDLINE_ONLINELOG_IDX
))
{
set_glog_onlinelog
(
online_log_messages
);
}
if
(
config_isparamset
(
cmdline_logparams
,
CMDLINE_GLOGLEVEL_IDX
))
{
set_glog
(
glog_level
,
-
1
);
}
if
(
config_isparamset
(
cmdline_logparams
,
CMDLINE_GLOGVERBO_IDX
))
{
set_glog
(
-
1
,
glog_verbosity
);
}
if
(
start_telnetsrv
)
{
load_module_shlib
(
"telnetsrv"
,
NULL
,
0
);
}
paramdef_t
cmdline_uemodeparams
[]
=
CMDLINE_UEMODEPARAMS_DESC
;
paramdef_t
cmdline_ueparams
[]
=
CMDLINE_UEPARAMS_DESC
;
config_process_cmdline
(
cmdline_uemodeparams
,
sizeof
(
cmdline_uemodeparams
)
/
sizeof
(
paramdef_t
),
NULL
);
config_process_cmdline
(
cmdline_ueparams
,
sizeof
(
cmdline_ueparams
)
/
sizeof
(
paramdef_t
),
NULL
);
if
(
loopfile
!=
NULL
)
{
printf
(
"Input file for hardware emulation: %s"
,
loopfile
);
mode
=
loop_through_memory
;
input_fd
=
fopen
(
loopfile
,
"r"
);
AssertFatal
(
input_fd
!=
NULL
,
"Please provide a valid input file
\n
"
);
}
if
(
(
cmdline_uemodeparams
[
CMDLINE_CALIBUERX_IDX
].
paramflags
&
PARAMFLAG_PARAMSET
)
!=
0
)
mode
=
rx_calib_ue
;
if
(
(
cmdline_uemodeparams
[
CMDLINE_CALIBUERXMED_IDX
].
paramflags
&
PARAMFLAG_PARAMSET
)
!=
0
)
mode
=
rx_calib_ue_med
;
if
(
(
cmdline_uemodeparams
[
CMDLINE_CALIBUERXBYP_IDX
].
paramflags
&
PARAMFLAG_PARAMSET
)
!=
0
)
mode
=
rx_calib_ue_byp
;
if
(
cmdline_uemodeparams
[
CMDLINE_DEBUGUEPRACH_IDX
].
uptr
)
if
(
*
(
cmdline_uemodeparams
[
CMDLINE_DEBUGUEPRACH_IDX
].
uptr
)
>
0
)
mode
=
debug_prach
;
if
(
cmdline_uemodeparams
[
CMDLINE_NOL2CONNECT_IDX
].
uptr
)
if
(
*
(
cmdline_uemodeparams
[
CMDLINE_NOL2CONNECT_IDX
].
uptr
)
>
0
)
mode
=
no_L2_connect
;
if
(
cmdline_uemodeparams
[
CMDLINE_CALIBPRACHTX_IDX
].
uptr
)
if
(
*
(
cmdline_uemodeparams
[
CMDLINE_CALIBPRACHTX_IDX
].
uptr
)
>
0
)
mode
=
calib_prach_tx
;
if
(
dumpframe
>
0
)
mode
=
rx_dump_frame
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
frame_parms
[
CC_id
]
->
dl_CarrierFreq
=
downlink_frequency
[
0
][
0
];
}
UE_scan
=
0
;
if
(
tddflag
>
0
)
{
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
frame_parms
[
CC_id
]
->
frame_type
=
TDD
;
}
if
(
frame_parms
[
0
]
->
N_RB_DL
!=
0
)
{
if
(
frame_parms
[
0
]
->
N_RB_DL
<
6
)
{
frame_parms
[
0
]
->
N_RB_DL
=
6
;
printf
(
"%i: Invalid number of ressource blocks, adjusted to 6
\n
"
,
frame_parms
[
0
]
->
N_RB_DL
);
}
if
(
frame_parms
[
0
]
->
N_RB_DL
>
100
)
{
frame_parms
[
0
]
->
N_RB_DL
=
100
;
printf
(
"%i: Invalid number of ressource blocks, adjusted to 100
\n
"
,
frame_parms
[
0
]
->
N_RB_DL
);
}
if
(
frame_parms
[
0
]
->
N_RB_DL
>
50
&&
frame_parms
[
0
]
->
N_RB_DL
<
100
)
{
frame_parms
[
0
]
->
N_RB_DL
=
50
;
printf
(
"%i: Invalid number of ressource blocks, adjusted to 50
\n
"
,
frame_parms
[
0
]
->
N_RB_DL
);
}
if
(
frame_parms
[
0
]
->
N_RB_DL
>
25
&&
frame_parms
[
0
]
->
N_RB_DL
<
50
)
{
frame_parms
[
0
]
->
N_RB_DL
=
25
;
printf
(
"%i: Invalid number of ressource blocks, adjusted to 25
\n
"
,
frame_parms
[
0
]
->
N_RB_DL
);
}
UE_scan
=
0
;
frame_parms
[
0
]
->
N_RB_UL
=
frame_parms
[
0
]
->
N_RB_DL
;
for
(
CC_id
=
1
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
frame_parms
[
CC_id
]
->
N_RB_DL
=
frame_parms
[
0
]
->
N_RB_DL
;
frame_parms
[
CC_id
]
->
N_RB_UL
=
frame_parms
[
0
]
->
N_RB_UL
;
}
}
for
(
CC_id
=
1
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
tx_max_power
[
CC_id
]
=
tx_max_power
[
0
];
rx_gain
[
0
][
CC_id
]
=
rx_gain
[
0
][
0
];
tx_gain
[
0
][
CC_id
]
=
tx_gain
[
0
][
0
];
}
#if T_TRACER
paramdef_t
cmdline_ttraceparams
[]
=
CMDLINE_TTRACEPARAMS_DESC
;
config_process_cmdline
(
cmdline_ttraceparams
,
sizeof
(
cmdline_ttraceparams
)
/
sizeof
(
paramdef_t
),
NULL
);
#endif
if
(
!
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
))
&&
(
!
(
CONFIG_ISFLAGSET
(
CONFIG_NOOOPT
)))
)
{
// Here the configuration file is the XER encoded UE capabilities
// Read it in and store in asn1c data structures
sprintf
(
uecap_xer
,
"%stargets/PROJECTS/GENERIC-LTE-EPC/CONF/UE_config.xml"
,
getenv
(
"OPENAIR_HOME"
));
printf
(
"%s
\n
"
,
uecap_xer
);
uecap_xer_in
=
1
;
}
/* UE with config file */
}
#if T_TRACER
int
T_nowait
=
0
;
/* by default we wait for the tracer */
int
T_port
=
2021
;
/* default port to listen to to wait for the tracer */
int
T_dont_fork
=
0
;
/* default is to fork, see 'T_init' to understand */
#endif
void
set_default_frame_parms
(
LTE_DL_FRAME_PARMS
*
frame_parms
[
MAX_NUM_CCs
])
{
int
CC_id
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
frame_parms
[
CC_id
]
=
(
LTE_DL_FRAME_PARMS
*
)
malloc
(
sizeof
(
LTE_DL_FRAME_PARMS
));
/* Set some default values that may be overwritten while reading options */
frame_parms
[
CC_id
]
->
frame_type
=
FDD
;
frame_parms
[
CC_id
]
->
tdd_config
=
3
;
frame_parms
[
CC_id
]
->
tdd_config_S
=
0
;
frame_parms
[
CC_id
]
->
N_RB_DL
=
100
;
frame_parms
[
CC_id
]
->
N_RB_UL
=
100
;
frame_parms
[
CC_id
]
->
Ncp
=
NORMAL
;
frame_parms
[
CC_id
]
->
Ncp_UL
=
NORMAL
;
frame_parms
[
CC_id
]
->
Nid_cell
=
0
;
frame_parms
[
CC_id
]
->
num_MBSFN_config
=
0
;
frame_parms
[
CC_id
]
->
nb_antenna_ports_eNB
=
1
;
frame_parms
[
CC_id
]
->
nb_antennas_tx
=
1
;
frame_parms
[
CC_id
]
->
nb_antennas_rx
=
1
;
frame_parms
[
CC_id
]
->
nushift
=
0
;
frame_parms
[
CC_id
]
->
phich_config_common
.
phich_resource
=
oneSixth
;
frame_parms
[
CC_id
]
->
phich_config_common
.
phich_duration
=
normal
;
// UL RS Config
frame_parms
[
CC_id
]
->
pusch_config_common
.
ul_ReferenceSignalsPUSCH
.
cyclicShift
=
0
;
//n_DMRS1 set to 0
frame_parms
[
CC_id
]
->
pusch_config_common
.
ul_ReferenceSignalsPUSCH
.
groupHoppingEnabled
=
0
;
frame_parms
[
CC_id
]
->
pusch_config_common
.
ul_ReferenceSignalsPUSCH
.
sequenceHoppingEnabled
=
0
;
frame_parms
[
CC_id
]
->
pusch_config_common
.
ul_ReferenceSignalsPUSCH
.
groupAssignmentPUSCH
=
0
;
frame_parms
[
CC_id
]
->
prach_config_common
.
rootSequenceIndex
=
22
;
frame_parms
[
CC_id
]
->
prach_config_common
.
prach_ConfigInfo
.
zeroCorrelationZoneConfig
=
1
;
frame_parms
[
CC_id
]
->
prach_config_common
.
prach_ConfigInfo
.
prach_ConfigIndex
=
0
;
frame_parms
[
CC_id
]
->
prach_config_common
.
prach_ConfigInfo
.
highSpeedFlag
=
0
;
frame_parms
[
CC_id
]
->
prach_config_common
.
prach_ConfigInfo
.
prach_FreqOffset
=
0
;
downlink_frequency
[
CC_id
][
0
]
=
DEFAULT_DLF
;
// Use float to avoid issue with frequency over 2^31.
downlink_frequency
[
CC_id
][
1
]
=
downlink_frequency
[
CC_id
][
0
];
downlink_frequency
[
CC_id
][
2
]
=
downlink_frequency
[
CC_id
][
0
];
downlink_frequency
[
CC_id
][
3
]
=
downlink_frequency
[
CC_id
][
0
];
frame_parms
[
CC_id
]
->
dl_CarrierFreq
=
downlink_frequency
[
CC_id
][
0
];
}
}
void
init_openair0
(
void
)
{
int
card
;
int
i
;
for
(
card
=
0
;
card
<
MAX_CARDS
;
card
++
)
{
openair0_cfg
[
card
].
mmapped_dma
=
mmapped_dma
;
openair0_cfg
[
card
].
configFilename
=
NULL
;
if
(
frame_parms
[
0
]
->
N_RB_DL
==
100
)
{
if
(
frame_parms
[
0
]
->
threequarter_fs
)
{
openair0_cfg
[
card
].
sample_rate
=
23.04e6
;
openair0_cfg
[
card
].
samples_per_frame
=
230400
;
openair0_cfg
[
card
].
tx_bw
=
10e6
;
openair0_cfg
[
card
].
rx_bw
=
10e6
;
}
else
{
openair0_cfg
[
card
].
sample_rate
=
30.72e6
;
openair0_cfg
[
card
].
samples_per_frame
=
307200
;
openair0_cfg
[
card
].
tx_bw
=
10e6
;
openair0_cfg
[
card
].
rx_bw
=
10e6
;
}
}
else
if
(
frame_parms
[
0
]
->
N_RB_DL
==
50
)
{
openair0_cfg
[
card
].
sample_rate
=
15.36e6
;
openair0_cfg
[
card
].
samples_per_frame
=
153600
;
openair0_cfg
[
card
].
tx_bw
=
5e6
;
openair0_cfg
[
card
].
rx_bw
=
5e6
;
}
else
if
(
frame_parms
[
0
]
->
N_RB_DL
==
25
)
{
openair0_cfg
[
card
].
sample_rate
=
7.68e6
;
openair0_cfg
[
card
].
samples_per_frame
=
76800
;
openair0_cfg
[
card
].
tx_bw
=
2.5e6
;
openair0_cfg
[
card
].
rx_bw
=
2.5e6
;
}
else
if
(
frame_parms
[
0
]
->
N_RB_DL
==
6
)
{
openair0_cfg
[
card
].
sample_rate
=
1.92e6
;
openair0_cfg
[
card
].
samples_per_frame
=
19200
;
openair0_cfg
[
card
].
tx_bw
=
1.5e6
;
openair0_cfg
[
card
].
rx_bw
=
1.5e6
;
}
if
(
frame_parms
[
0
]
->
frame_type
==
TDD
)
openair0_cfg
[
card
].
duplex_mode
=
duplex_mode_TDD
;
else
//FDD
openair0_cfg
[
card
].
duplex_mode
=
duplex_mode_FDD
;
printf
(
"HW: Configuring card %d, nb_antennas_tx/rx %d/%d
\n
"
,
card
,
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
nb_antennas_tx
,
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
nb_antennas_rx
);
openair0_cfg
[
card
].
Mod_id
=
0
;
openair0_cfg
[
card
].
num_rb_dl
=
frame_parms
[
0
]
->
N_RB_DL
;
openair0_cfg
[
card
].
clock_source
=
clock_source
;
openair0_cfg
[
card
].
tx_num_channels
=
min
(
2
,
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
nb_antennas_tx
);
openair0_cfg
[
card
].
rx_num_channels
=
min
(
2
,
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
nb_antennas_rx
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
(
i
<
openair0_cfg
[
card
].
tx_num_channels
)
openair0_cfg
[
card
].
tx_freq
[
i
]
=
downlink_frequency
[
0
][
i
]
+
uplink_frequency_offset
[
0
][
i
];
else
openair0_cfg
[
card
].
tx_freq
[
i
]
=
0
.
0
;
if
(
i
<
openair0_cfg
[
card
].
rx_num_channels
)
openair0_cfg
[
card
].
rx_freq
[
i
]
=
downlink_frequency
[
0
][
i
];
else
openair0_cfg
[
card
].
rx_freq
[
i
]
=
0
.
0
;
openair0_cfg
[
card
].
autocal
[
i
]
=
1
;
openair0_cfg
[
card
].
tx_gain
[
i
]
=
tx_gain
[
0
][
i
];
openair0_cfg
[
card
].
rx_gain
[
i
]
=
PHY_vars_UE_g
[
0
][
0
]
->
rx_total_gain_dB
-
rx_gain_off
;
openair0_cfg
[
card
].
configFilename
=
rf_config_file
;
printf
(
"Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f
\n
"
,
card
,
i
,
openair0_cfg
[
card
].
tx_gain
[
i
],
openair0_cfg
[
card
].
rx_gain
[
i
],
openair0_cfg
[
card
].
tx_freq
[
i
],
openair0_cfg
[
card
].
rx_freq
[
i
]);
}
}
}
#if defined(ENABLE_ITTI)
/*
* helper function to terminate a certain ITTI task
*/
void
terminate_task
(
task_id_t
task_id
,
module_id_t
mod_id
)
{
LOG_I
(
ENB_APP
,
"sending TERMINATE_MESSAGE to task %s (%d)
\n
"
,
itti_get_task_name
(
task_id
),
task_id
);
MessageDef
*
msg
;
msg
=
itti_alloc_new_message
(
ENB_APP
,
TERMINATE_MESSAGE
);
itti_send_msg_to_task
(
task_id
,
ENB_MODULE_ID_TO_INSTANCE
(
mod_id
),
msg
);
}
#endif
int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
#if defined (XFORMS)
void
*
status
;
#endif
int
CC_id
;
uint8_t
abstraction_flag
=
0
;
uint8_t
beta_ACK
=
0
,
beta_RI
=
0
,
beta_CQI
=
2
;
#if defined (XFORMS)
int
ret
;
#endif
start_background_system
();
if
(
load_configmodule
(
argc
,
argv
)
==
NULL
)
{
exit_fun
(
"[SOFTMODEM] Error, configuration module init failed
\n
"
);
}
#ifdef DEBUG_CONSOLE
setvbuf
(
stdout
,
NULL
,
_IONBF
,
0
);
setvbuf
(
stderr
,
NULL
,
_IONBF
,
0
);
#endif
PHY_VARS_UE
*
UE
[
MAX_NUM_CCs
];
mode
=
normal_txrx
;
memset
(
&
openair0_cfg
[
0
],
0
,
sizeof
(
openair0_config_t
)
*
MAX_CARDS
);
memset
(
tx_max_power
,
0
,
sizeof
(
int
)
*
MAX_NUM_CCs
);
set_latency_target
();
logInit
();
printf
(
"Reading in command-line options
\n
"
);
get_options
();
#if T_TRACER
T_init
(
T_port
,
1
-
T_nowait
,
T_dont_fork
);
#endif
//randominit (0);
set_taus_seed
(
0
);
set_comp_log
(
HW
,
LOG_DEBUG
,
LOG_HIGH
,
1
);
set_comp_log
(
PHY
,
LOG_INFO
,
LOG_HIGH
,
1
);
set_comp_log
(
MAC
,
LOG_INFO
,
LOG_HIGH
,
1
);
set_comp_log
(
RLC
,
LOG_INFO
,
LOG_HIGH
|
FLAG_THREAD
,
1
);
set_comp_log
(
PDCP
,
LOG_INFO
,
LOG_HIGH
,
1
);
set_comp_log
(
OTG
,
LOG_INFO
,
LOG_HIGH
,
1
);
set_comp_log
(
RRC
,
LOG_INFO
,
LOG_HIGH
,
1
);
#if defined(ENABLE_ITTI)
set_comp_log
(
EMU
,
LOG_INFO
,
LOG_MED
,
1
);
# if defined(ENABLE_USE_MME)
set_comp_log
(
NAS
,
LOG_INFO
,
LOG_HIGH
,
1
);
# endif
#endif
if
(
ouput_vcd
)
{
VCD_SIGNAL_DUMPER_INIT
(
"/tmp/openair_dump_UE.vcd"
);
}
cpuf
=
get_cpu_freq_GHz
();
#if defined(ENABLE_ITTI)
log_set_instance_type
(
LOG_INSTANCE_UE
);
printf
(
"ITTI init
\n
"
);
itti_init
(
TASK_MAX
,
THREAD_MAX
,
MESSAGES_ID_MAX
,
tasks_info
,
messages_info
,
messages_definition_xml
,
itti_dump_file
);
// initialize mscgen log after ITTI
MSC_INIT
(
MSC_E_UTRAN
,
THREAD_MAX
+
TASK_MAX
);
#endif
if
(
opt_type
!=
OPT_NONE
)
{
radio_type_t
radio_type
;
if
(
frame_parms
[
0
]
->
frame_type
==
FDD
)
radio_type
=
RADIO_TYPE_FDD
;
else
radio_type
=
RADIO_TYPE_TDD
;
if
(
init_opt
(
in_path
,
in_ip
,
NULL
,
radio_type
)
==
-
1
)
LOG_E
(
OPT
,
"failed to run OPT
\n
"
);
}
#ifdef PDCP_USE_NETLINK
printf
(
"PDCP netlink
\n
"
);
netlink_init
();
#if defined(PDCP_USE_NETLINK_QUEUES)
pdcp_netlink_init
();
#endif
#endif
#if !defined(ENABLE_ITTI)
// to make a graceful exit when ctrl-c is pressed
signal
(
SIGSEGV
,
signal_handler
);
signal
(
SIGINT
,
signal_handler
);
#endif
check_clock
();
#ifndef PACKAGE_VERSION
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
#endif
LOG_I
(
HW
,
"Version: %s
\n
"
,
PACKAGE_VERSION
);
// init the parameters
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
frame_parms
[
CC_id
]
->
nb_antennas_tx
=
nb_antenna_tx
;
frame_parms
[
CC_id
]
->
nb_antennas_rx
=
nb_antenna_rx
;
frame_parms
[
CC_id
]
->
nb_antenna_ports_eNB
=
1
;
//initial value overwritten by initial sync later
}
printf
(
"Before CC
\n
"
);
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
NB_UE_INST
=
1
;
NB_INST
=
1
;
PHY_vars_UE_g
=
malloc
(
sizeof
(
PHY_VARS_UE
**
));
PHY_vars_UE_g
[
0
]
=
malloc
(
sizeof
(
PHY_VARS_UE
*
)
*
MAX_NUM_CCs
);
PHY_vars_UE_g
[
0
][
CC_id
]
=
init_ue_vars
(
frame_parms
[
CC_id
],
0
,
abstraction_flag
);
UE
[
CC_id
]
=
PHY_vars_UE_g
[
0
][
CC_id
];
printf
(
"PHY_vars_UE_g[0][%d] = %p
\n
"
,
CC_id
,
UE
[
CC_id
]);
if
(
phy_test
==
1
)
UE
[
CC_id
]
->
mac_enabled
=
0
;
else
UE
[
CC_id
]
->
mac_enabled
=
1
;
if
(
UE
[
CC_id
]
->
mac_enabled
==
0
)
{
//set default UL parameters for testing mode
for
(
i
=
0
;
i
<
NUMBER_OF_CONNECTED_eNB_MAX
;
i
++
)
{
UE
[
CC_id
]
->
pusch_config_dedicated
[
i
].
betaOffset_ACK_Index
=
beta_ACK
;
UE
[
CC_id
]
->
pusch_config_dedicated
[
i
].
betaOffset_RI_Index
=
beta_RI
;
UE
[
CC_id
]
->
pusch_config_dedicated
[
i
].
betaOffset_CQI_Index
=
beta_CQI
;
UE
[
CC_id
]
->
scheduling_request_config
[
i
].
sr_PUCCH_ResourceIndex
=
0
;
UE
[
CC_id
]
->
scheduling_request_config
[
i
].
sr_ConfigIndex
=
7
+
(
0
%
3
);
UE
[
CC_id
]
->
scheduling_request_config
[
i
].
dsr_TransMax
=
sr_n4
;
}
}
UE
[
CC_id
]
->
UE_scan
=
UE_scan
;
UE
[
CC_id
]
->
UE_scan_carrier
=
UE_scan_carrier
;
UE
[
CC_id
]
->
mode
=
mode
;
printf
(
"UE[%d]->mode = %d
\n
"
,
CC_id
,
mode
);
if
(
UE
[
CC_id
]
->
mac_enabled
==
1
)
{
UE
[
CC_id
]
->
pdcch_vars
[
0
][
0
]
->
crnti
=
0x1234
;
UE
[
CC_id
]
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1234
;
}
else
{
UE
[
CC_id
]
->
pdcch_vars
[
0
][
0
]
->
crnti
=
0x1235
;
UE
[
CC_id
]
->
pdcch_vars
[
1
][
0
]
->
crnti
=
0x1235
;
}
UE
[
CC_id
]
->
rx_total_gain_dB
=
(
int
)
rx_gain
[
CC_id
][
0
]
+
rx_gain_off
;
UE
[
CC_id
]
->
tx_power_max_dBm
=
tx_max_power
[
CC_id
];
if
(
frame_parms
[
CC_id
]
->
frame_type
==
FDD
)
{
UE
[
CC_id
]
->
N_TA_offset
=
0
;
}
else
{
if
(
frame_parms
[
CC_id
]
->
N_RB_DL
==
100
)
UE
[
CC_id
]
->
N_TA_offset
=
624
;
else
if
(
frame_parms
[
CC_id
]
->
N_RB_DL
==
50
)
UE
[
CC_id
]
->
N_TA_offset
=
624
/
2
;
else
if
(
frame_parms
[
CC_id
]
->
N_RB_DL
==
25
)
UE
[
CC_id
]
->
N_TA_offset
=
624
/
4
;
}
init_openair0
();
}
printf
(
"Runtime table
\n
"
);
fill_modeled_runtime_table
(
runtime_phy_rx
,
runtime_phy_tx
);
cpuf
=
get_cpu_freq_GHz
();
#ifndef DEADLINE_SCHEDULER
printf
(
"NO deadline scheduler
\n
"
);
/* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
cpu_set_t
cpuset
;
int
s
;
char
cpu_affinity
[
1024
];
CPU_ZERO
(
&
cpuset
);
#ifdef CPU_AFFINITY
if
(
get_nprocs
()
>
2
)
{
CPU_SET
(
0
,
&
cpuset
);
s
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
if
(
s
!=
0
)
{
perror
(
"pthread_setaffinity_np"
);
exit_fun
(
"Error setting processor affinity"
);
}
LOG_I
(
HW
,
"Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!
\n
"
);
}
#endif
/* Check the actual affinity mask assigned to the thread */
s
=
pthread_getaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
if
(
s
!=
0
)
{
perror
(
"pthread_getaffinity_np"
);
exit_fun
(
"Error getting processor affinity "
);
}
memset
(
cpu_affinity
,
0
,
sizeof
(
cpu_affinity
));
for
(
int
j
=
0
;
j
<
CPU_SETSIZE
;
j
++
)
{
if
(
CPU_ISSET
(
j
,
&
cpuset
))
{
char
temp
[
1024
];
sprintf
(
temp
,
" CPU_%d "
,
j
);
strcat
(
cpu_affinity
,
temp
);
}
}
LOG_I
(
HW
,
"CPU Affinity of main() function is... %s
\n
"
,
cpu_affinity
);
#endif
#if defined(ENABLE_ITTI)
if
(
create_tasks_ue
(
1
)
<
0
)
{
printf
(
"cannot create ITTI tasks
\n
"
);
exit
(
-
1
);
// need a softer mode
}
printf
(
"ITTI tasks created
\n
"
);
#endif
// init UE_PF_PO and mutex lock
pthread_mutex_init
(
&
ue_pf_po_mutex
,
NULL
);
memset
(
&
UE_PF_PO
[
0
][
0
],
0
,
sizeof
(
UE_PF_PO_t
)
*
NUMBER_OF_UE_MAX
*
MAX_NUM_CCs
);
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
);
pthread_cond_init
(
&
sync_cond
,
NULL
);
pthread_mutex_init
(
&
sync_mutex
,
NULL
);
#ifdef XFORMS
int
UE_id
;
printf
(
"XFORMS
\n
"
);
if
(
do_forms
==
1
)
{
fl_initialize
(
&
argc
,
argv
,
NULL
,
0
,
0
);
form_stats
=
create_form_stats_form
();
fl_show_form
(
form_stats
->
stats_form
,
FL_PLACE_HOTSPOT
,
FL_FULLBORDER
,
"stats"
);
UE_id
=
0
;
form_ue
[
UE_id
]
=
create_lte_phy_scope_ue
();
sprintf
(
title
,
"LTE DL SCOPE UE"
);
fl_show_form
(
form_ue
[
UE_id
]
->
lte_phy_scope_ue
,
FL_PLACE_HOTSPOT
,
FL_FULLBORDER
,
title
);
/*
if (openair_daq_vars.use_ia_receiver) {
fl_set_button(form_ue[UE_id]->button_0,1);
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
} else {
fl_set_button(form_ue[UE_id]->button_0,0);
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
}*/
fl_set_button
(
form_ue
[
UE_id
]
->
button_0
,
0
);
fl_set_object_label
(
form_ue
[
UE_id
]
->
button_0
,
"IA Receiver OFF"
);
ret
=
pthread_create
(
&
forms_thread
,
NULL
,
scope_thread
,
NULL
);
if
(
ret
==
0
)
pthread_setname_np
(
forms_thread
,
"xforms"
);
printf
(
"Scope thread created, ret=%d
\n
"
,
ret
);
}
#endif
rt_sleep_ns
(
10
*
100000000ULL
);
// start the main threads
int
eMBMS_active
=
0
;
init_UE
(
1
,
eMBMS_active
,
uecap_xer_in
,
0
);
if
(
phy_test
==
0
)
{
printf
(
"Filling UE band info
\n
"
);
fill_ue_band_info
();
dl_phy_sync_success
(
0
,
0
,
0
,
1
);
}
number_of_cards
=
1
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
PHY_vars_UE_g
[
0
][
CC_id
]
->
rf_map
.
card
=
0
;
PHY_vars_UE_g
[
0
][
CC_id
]
->
rf_map
.
chain
=
CC_id
+
chain_offset
;
}
// connect the TX/RX buffers
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
#ifdef OAI_USRP
UE
[
CC_id
]
->
hw_timing_advance
=
timing_advance
;
#else
UE
[
CC_id
]
->
hw_timing_advance
=
160
;
#endif
}
if
(
setup_ue_buffers
(
UE
,
&
openair0_cfg
[
0
])
!=
0
)
{
printf
(
"Error setting up eNB buffer
\n
"
);
exit
(
-
1
);
}
if
(
input_fd
)
{
printf
(
"Reading in from file to antenna buffer %d
\n
"
,
0
);
if
(
fread
(
UE
[
0
]
->
common_vars
.
rxdata
[
0
],
sizeof
(
int32_t
),
frame_parms
[
0
]
->
samples_per_tti
*
10
,
input_fd
)
!=
frame_parms
[
0
]
->
samples_per_tti
*
10
)
printf
(
"error reading from file
\n
"
);
}
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
printf
(
"Sending sync to all threads
\n
"
);
pthread_mutex_lock
(
&
sync_mutex
);
sync_var
=
0
;
pthread_cond_broadcast
(
&
sync_cond
);
pthread_mutex_unlock
(
&
sync_mutex
);
printf
(
"About to call end_configmodule() from %s() %s:%d
\n
"
,
__FUNCTION__
,
__FILE__
,
__LINE__
);
end_configmodule
();
printf
(
"Called end_configmodule() from %s() %s:%d
\n
"
,
__FUNCTION__
,
__FILE__
,
__LINE__
);
// wait for end of program
printf
(
"TYPE <CTRL-C> TO TERMINATE
\n
"
);
//getchar();
#if defined(ENABLE_ITTI)
printf
(
"Entering ITTI signals handler
\n
"
);
itti_wait_tasks_end
();
printf
(
"Returned from ITTI signal handler
\n
"
);
oai_exit
=
1
;
printf
(
"oai_exit=%d
\n
"
,
oai_exit
);
#else
while
(
oai_exit
==
0
)
rt_sleep_ns
(
100000000ULL
);
printf
(
"Terminating application - oai_exit=%d
\n
"
,
oai_exit
);
#endif
// stop threads
#ifdef XFORMS
printf
(
"waiting for XFORMS thread
\n
"
);
if
(
do_forms
==
1
)
{
pthread_join
(
forms_thread
,
&
status
);
fl_hide_form
(
form_stats
->
stats_form
);
fl_free_form
(
form_stats
->
stats_form
);
fl_hide_form
(
form_ue
[
0
]
->
lte_phy_scope_ue
);
fl_free_form
(
form_ue
[
0
]
->
lte_phy_scope_ue
);
}
#endif
printf
(
"stopping MODEM threads
\n
"
);
pthread_cond_destroy
(
&
sync_cond
);
pthread_mutex_destroy
(
&
sync_mutex
);
pthread_mutex_destroy
(
&
ue_pf_po_mutex
);
// *** Handle per CC_id openair0
if
(
PHY_vars_UE_g
[
0
][
0
]
->
rfdevice
.
trx_end_func
)
PHY_vars_UE_g
[
0
][
0
]
->
rfdevice
.
trx_end_func
(
&
PHY_vars_UE_g
[
0
][
0
]
->
rfdevice
);
if
(
ouput_vcd
)
VCD_SIGNAL_DUMPER_CLOSE
();
if
(
opt_enabled
==
1
)
terminate_opt
();
logClean
();
printf
(
"Bye.
\n
"
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment