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
lizhongxiao
OpenXG-RAN
Commits
470ecad2
Commit
470ecad2
authored
Aug 10, 2020
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/add_chansimuparams' into develop_integration_2020_w31
parents
e83acab6
d4bd2cdc
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
396 additions
and
106 deletions
+396
-106
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+4
-4
cmake_targets/build_oai
cmake_targets/build_oai
+1
-1
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+35
-4
common/utils/telnetsrv/telnetsrv.h
common/utils/telnetsrv/telnetsrv.h
+15
-3
executables/nr-softmodem.c
executables/nr-softmodem.c
+8
-6
executables/nr-softmodem.h
executables/nr-softmodem.h
+0
-9
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+8
-6
executables/nr-uesoftmodem.h
executables/nr-uesoftmodem.h
+0
-8
openair1/PHY/TOOLS/nr_phy_scope.c
openair1/PHY/TOOLS/nr_phy_scope.c
+12
-0
openair1/PHY/TOOLS/nr_phy_scope.h
openair1/PHY/TOOLS/nr_phy_scope.h
+0
-2
openair1/PHY/TOOLS/phy_scope_interface.c
openair1/PHY/TOOLS/phy_scope_interface.c
+2
-2
openair1/PHY/TOOLS/phy_scope_interface.h
openair1/PHY/TOOLS/phy_scope_interface.h
+1
-1
openair1/SIMULATION/TOOLS/random_channel.c
openair1/SIMULATION/TOOLS/random_channel.c
+195
-43
openair1/SIMULATION/TOOLS/sim.h
openair1/SIMULATION/TOOLS/sim.h
+32
-4
targets/ARCH/rfsimulator/simulator.c
targets/ARCH/rfsimulator/simulator.c
+81
-11
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+1
-1
targets/RT/USER/lte-uesoftmodem.c
targets/RT/USER/lte-uesoftmodem.c
+1
-1
No files found.
cmake_targets/CMakeLists.txt
View file @
470ecad2
...
@@ -2478,8 +2478,8 @@ add_library(uescope MODULE ${XFORMS_SOURCE} ${XFORMS_SOURCE_SOFTMODEM} ${XFORMS_
...
@@ -2478,8 +2478,8 @@ add_library(uescope MODULE ${XFORMS_SOURCE} ${XFORMS_SOURCE_SOFTMODEM} ${XFORMS_
target_link_libraries
(
enbscope
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
enbscope
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
uescope
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
uescope
${
XFORMS_LIBRARIES
}
)
add_library
(
gnb
scope MODULE
${
XFORMS_SOURCE_NR
}
)
add_library
(
nr
scope MODULE
${
XFORMS_SOURCE_NR
}
)
target_link_libraries
(
gnb
scope
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
nr
scope
${
XFORMS_LIBRARIES
}
)
add_library
(
rfsimulator MODULE
add_library
(
rfsimulator MODULE
...
@@ -2735,7 +2735,7 @@ add_executable(nr-softmodem
...
@@ -2735,7 +2735,7 @@ add_executable(nr-softmodem
${
OPENAIR_DIR
}
/common/utils/system.c
${
OPENAIR_DIR
}
/common/utils/system.c
${
OPENAIR_DIR
}
/common/utils/nr/nr_common.c
${
OPENAIR_DIR
}
/common/utils/nr/nr_common.c
${
GTPU_need_ITTI
}
${
GTPU_need_ITTI
}
${
XFORMS
_SOURCE_NR
}
${
XFORMS
INTERFACE_SOURCE
}
${
T_SOURCE
}
${
T_SOURCE
}
${
CONFIG_SOURCES
}
${
CONFIG_SOURCES
}
${
SHLIB_LOADER_SOURCES
}
${
SHLIB_LOADER_SOURCES
}
...
@@ -2777,7 +2777,7 @@ add_executable(nr-uesoftmodem
...
@@ -2777,7 +2777,7 @@ add_executable(nr-uesoftmodem
${
OPENAIR_DIR
}
/common/utils/utils.c
${
OPENAIR_DIR
}
/common/utils/utils.c
${
OPENAIR_DIR
}
/common/utils/system.c
${
OPENAIR_DIR
}
/common/utils/system.c
${
OPENAIR_DIR
}
/common/utils/nr/nr_common.c
${
OPENAIR_DIR
}
/common/utils/nr/nr_common.c
${
XFORMS
_SOURCE_NR
}
${
XFORMS
INTERFACE_SOURCE
}
${
T_SOURCE
}
${
T_SOURCE
}
${
UTIL_SRC
}
${
UTIL_SRC
}
${
CONFIG_SOURCES
}
${
CONFIG_SOURCES
}
...
...
cmake_targets/build_oai
View file @
470ecad2
...
@@ -67,7 +67,7 @@ UE_TIMING_TRACE="False"
...
@@ -67,7 +67,7 @@ UE_TIMING_TRACE="False"
USRP_REC_PLAY
=
"False"
USRP_REC_PLAY
=
"False"
BUILD_ECLIPSE
=
0
BUILD_ECLIPSE
=
0
NR
=
"False"
NR
=
"False"
OPTIONAL_LIBRARIES
=
"telnetsrv enbscope uescope msc"
OPTIONAL_LIBRARIES
=
"telnetsrv enbscope uescope
nrscope
msc"
trap
handle_ctrl_c INT
trap
handle_ctrl_c INT
function
print_help
()
{
function
print_help
()
{
...
...
common/utils/telnetsrv/telnetsrv.c
View file @
470ecad2
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
#include <sys/resource.h>
#include <sys/resource.h>
#include "common/utils/load_module_shlib.h"
#include "common/utils/load_module_shlib.h"
#include "common/config/config_userapi.h"
#include "common/config/config_userapi.h"
#include "common/utils/threadPool/thread-pool.h"
#include "executables/softmodem-common.h"
#include "executables/softmodem-common.h"
#include <readline/history.h>
#include <readline/history.h>
...
@@ -507,12 +508,22 @@ int process_command(char *buf) {
...
@@ -507,12 +508,22 @@ int process_command(char *buf) {
}
}
rt
=
CMDSTATUS_FOUND
;
rt
=
CMDSTATUS_FOUND
;
}
else
if
(
str
ncasecmp
(
cmd
,
"get"
,
3
)
==
0
||
strncasecmp
(
cmd
,
"set"
,
3
)
==
0
)
{
}
else
if
(
str
casecmp
(
cmd
,
"get"
)
==
0
||
strcasecmp
(
cmd
,
"set"
)
==
0
)
{
rt
=
setgetvar
(
i
,
cmd
[
0
],
cmdb
);
rt
=
setgetvar
(
i
,
cmd
[
0
],
cmdb
);
}
else
{
}
else
{
for
(
k
=
0
;
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdfunc
!=
NULL
;
k
++
)
{
for
(
k
=
0
;
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdfunc
!=
NULL
;
k
++
)
{
if
(
strncasecmp
(
cmd
,
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdname
,
sizeof
(
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdname
))
==
0
)
{
if
(
strncasecmp
(
cmd
,
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdname
,
sizeof
(
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdname
))
==
0
)
{
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdfunc
(
cmdb
,
telnetparams
.
telnetdbg
,
client_printf
);
if
(
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
qptr
!=
NULL
)
{
notifiedFIFO_elt_t
*
msg
=
newNotifiedFIFO_elt
(
sizeof
(
telnetsrv_qmsg_t
),
0
,
NULL
,
NULL
);
telnetsrv_qmsg_t
*
cmddata
=
NotifiedFifoData
(
msg
);
cmddata
->
cmdfunc
=
(
qcmdfunc_t
)
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdfunc
;
cmddata
->
prnt
=
client_printf
;
cmddata
->
debug
=
telnetparams
.
telnetdbg
;
cmddata
->
cmdbuff
=
strdup
(
cmdb
);
pushNotifiedFIFO
(
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
qptr
,
msg
);
}
else
{
telnetparams
.
CmdParsers
[
i
].
cmd
[
k
].
cmdfunc
(
cmdb
,
telnetparams
.
telnetdbg
,
client_printf
);
}
rt
=
CMDSTATUS_FOUND
;
rt
=
CMDSTATUS_FOUND
;
}
}
}
/* for k */
}
/* for k */
...
@@ -673,6 +684,16 @@ void run_telnetsrv(void) {
...
@@ -673,6 +684,16 @@ void run_telnetsrv(void) {
return
;
return
;
}
}
void
poll_telnetcmdq
(
void
*
qid
,
void
*
arg
)
{
notifiedFIFO_elt_t
*
msg
=
pollNotifiedFIFO
((
notifiedFIFO_t
*
)
qid
);
if
(
msg
!=
NULL
)
{
telnetsrv_qmsg_t
*
msgdata
=
NotifiedFifoData
(
msg
);
msgdata
->
cmdfunc
(
msgdata
->
cmdbuff
,
msgdata
->
debug
,
msgdata
->
prnt
,
arg
);
free
(
msgdata
->
cmdbuff
);
delNotifiedFIFO_elt
(
msg
);
}
}
/*------------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------*/
/* load the commands delivered with the telnet server
/* load the commands delivered with the telnet server
*
*
...
@@ -758,6 +779,7 @@ int telnetsrv_autoinit(void) {
...
@@ -758,6 +779,7 @@ int telnetsrv_autoinit(void) {
*/
*/
int
add_telnetcmd
(
char
*
modulename
,
telnetshell_vardef_t
*
var
,
telnetshell_cmddef_t
*
cmd
)
{
int
add_telnetcmd
(
char
*
modulename
,
telnetshell_vardef_t
*
var
,
telnetshell_cmddef_t
*
cmd
)
{
int
i
;
int
i
;
notifiedFIFO_t
*
afifo
=
NULL
;
if
(
modulename
==
NULL
||
var
==
NULL
||
cmd
==
NULL
)
{
if
(
modulename
==
NULL
||
var
==
NULL
||
cmd
==
NULL
)
{
fprintf
(
stderr
,
"[TELNETSRV] Telnet server, add_telnetcmd: invalid parameters
\n
"
);
fprintf
(
stderr
,
"[TELNETSRV] Telnet server, add_telnetcmd: invalid parameters
\n
"
);
...
@@ -769,6 +791,13 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
...
@@ -769,6 +791,13 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
strncpy
(
telnetparams
.
CmdParsers
[
i
].
module
,
modulename
,
sizeof
(
telnetparams
.
CmdParsers
[
i
].
module
)
-
1
);
strncpy
(
telnetparams
.
CmdParsers
[
i
].
module
,
modulename
,
sizeof
(
telnetparams
.
CmdParsers
[
i
].
module
)
-
1
);
telnetparams
.
CmdParsers
[
i
].
cmd
=
cmd
;
telnetparams
.
CmdParsers
[
i
].
cmd
=
cmd
;
telnetparams
.
CmdParsers
[
i
].
var
=
var
;
telnetparams
.
CmdParsers
[
i
].
var
=
var
;
if
(
cmd
->
cmdflags
&
TELNETSRV_CMDFLAG_PUSHINTPOOLQ
)
{
if
(
afifo
==
NULL
)
{
afifo
=
malloc
(
sizeof
(
notifiedFIFO_t
));
initNotifiedFIFO
(
afifo
);
}
cmd
->
qptr
=
afifo
;
}
printf
(
"[TELNETSRV] Telnet server: module %i = %s added to shell
\n
"
,
printf
(
"[TELNETSRV] Telnet server: module %i = %s added to shell
\n
"
,
i
,
telnetparams
.
CmdParsers
[
i
].
module
);
i
,
telnetparams
.
CmdParsers
[
i
].
module
);
break
;
break
;
...
@@ -797,8 +826,10 @@ int telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildvers
...
@@ -797,8 +826,10 @@ int telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildvers
}
}
int
telnetsrv_getfarray
(
loader_shlibfunc_t
**
farray
)
{
int
telnetsrv_getfarray
(
loader_shlibfunc_t
**
farray
)
{
*
farray
=
malloc
(
sizeof
(
loader_shlibfunc_t
));
*
farray
=
malloc
(
sizeof
(
loader_shlibfunc_t
)
*
2
);
(
*
farray
)[
0
].
fname
=
TELNET_ADDCMD_FNAME
;
(
*
farray
)[
0
].
fname
=
TELNET_ADDCMD_FNAME
;
(
*
farray
)[
0
].
fptr
=
(
int
(
*
)(
void
)
)
add_telnetcmd
;
(
*
farray
)[
0
].
fptr
=
(
int
(
*
)(
void
)
)
add_telnetcmd
;
return
1
;
(
*
farray
)[
1
].
fname
=
TELNET_POLLCMDQ_FNAME
;
(
*
farray
)[
1
].
fptr
=
(
int
(
*
)(
void
)
)
poll_telnetcmdq
;
return
(
2
);
}
}
common/utils/telnetsrv/telnetsrv.h
View file @
470ecad2
...
@@ -53,13 +53,26 @@
...
@@ -53,13 +53,26 @@
/* to add a set of new command to the telnet server shell */
/* to add a set of new command to the telnet server shell */
typedef
void
(
*
telnet_printfunc_t
)(
const
char
*
format
,
...);
typedef
void
(
*
telnet_printfunc_t
)(
const
char
*
format
,
...);
typedef
int
(
*
cmdfunc_t
)(
char
*
,
int
,
telnet_printfunc_t
prnt
);
typedef
int
(
*
cmdfunc_t
)(
char
*
,
int
,
telnet_printfunc_t
prnt
);
typedef
int
(
*
qcmdfunc_t
)(
char
*
,
int
,
telnet_printfunc_t
prnt
,
void
*
arg
);
#define TELNETSRV_CMDFLAG_PUSHINTPOOLQ (1<<0) // ask the telnet server to push the command in a thread pool queue
typedef
struct
cmddef
{
typedef
struct
cmddef
{
char
cmdname
[
TELNET_CMD_MAXSIZE
];
char
cmdname
[
TELNET_CMD_MAXSIZE
];
char
helpstr
[
TELNET_HELPSTR_SIZE
];
char
helpstr
[
TELNET_HELPSTR_SIZE
];
cmdfunc_t
cmdfunc
;
cmdfunc_t
cmdfunc
;
unsigned
int
cmdflags
;
void
*
qptr
;
}
telnetshell_cmddef_t
;
}
telnetshell_cmddef_t
;
/*----------------------------------------------------------------------------*/
/* structure used to send a command via a message queue to enable */
/* executing a command in a thread different from the telnet server thread */
typedef
struct
telnetsrv_qmsg
{
qcmdfunc_t
cmdfunc
;
telnet_printfunc_t
prnt
;
int
debug
;
char
*
cmdbuff
;
}
telnetsrv_qmsg_t
;
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*structure to be used when adding a module to the telnet server */
/*structure to be used when adding a module to the telnet server */
/* This is the first parameter of the add_telnetcmd function, which can be used */
/* This is the first parameter of the add_telnetcmd function, which can be used */
...
@@ -111,9 +124,6 @@ typedef struct {
...
@@ -111,9 +124,6 @@ typedef struct {
}
telnetsrv_params_t
;
}
telnetsrv_params_t
;
typedef
int
(
*
addcmdfunc_t
)(
char
*
,
telnetshell_vardef_t
*
,
telnetshell_cmddef_t
*
);
typedef
void
(
*
settelnetmodule_t
)(
char
*
name
,
void
*
ptr
);
typedef
void
(
*
settelnetmodule_t
)(
char
*
name
,
void
*
ptr
);
/*-------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------*/
...
@@ -133,7 +143,9 @@ VT escape sequence definition, for smarter display....
...
@@ -133,7 +143,9 @@ VT escape sequence definition, for smarter display....
/*---------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------*/
#define TELNET_ADDCMD_FNAME "add_telnetcmd"
#define TELNET_ADDCMD_FNAME "add_telnetcmd"
#define TELNET_POLLCMDQ_FNAME "poll_telnetcmdq"
typedef
int
(
*
add_telnetcmd_func_t
)(
char
*
,
telnetshell_vardef_t
*
,
telnetshell_cmddef_t
*
);
typedef
int
(
*
add_telnetcmd_func_t
)(
char
*
,
telnetshell_vardef_t
*
,
telnetshell_cmddef_t
*
);
typedef
void
(
*
poll_telnetcmdq_func_t
)(
void
*
qid
,
void
*
arg
);
#ifdef TELNETSERVERCODE
#ifdef TELNETSERVERCODE
int
add_telnetcmd
(
char
*
modulename
,
telnetshell_vardef_t
*
var
,
telnetshell_cmddef_t
*
cmd
);
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_sched
(
pthread_t
tid
,
int
pid
,
int
priority
);
...
...
executables/nr-softmodem.c
View file @
470ecad2
...
@@ -75,7 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13};
...
@@ -75,7 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "system.h"
#include "system.h"
#include <openair2/GNB_APP/gnb_app.h>
#include <openair2/GNB_APP/gnb_app.h>
#include "PHY/TOOLS/phy_scope_interface.h"
#include "PHY/TOOLS/nr_phy_scope.h"
#include "PHY/TOOLS/nr_phy_scope.h"
#include "stats.h"
#include "stats.h"
#include "nr-softmodem.h"
#include "nr-softmodem.h"
...
@@ -156,7 +156,6 @@ char channels[128] = "0";
...
@@ -156,7 +156,6 @@ char channels[128] = "0";
int
rx_input_level_dBm
;
int
rx_input_level_dBm
;
uint32_t
do_forms
=
0
;
int
otg_enabled
;
int
otg_enabled
;
//int number_of_cards = 1;
//int number_of_cards = 1;
...
@@ -454,7 +453,11 @@ static void get_options(void) {
...
@@ -454,7 +453,11 @@ static void get_options(void) {
paramdef_t
cmdline_params
[]
=
CMDLINE_PARAMS_DESC_GNB
;
paramdef_t
cmdline_params
[]
=
CMDLINE_PARAMS_DESC_GNB
;
CONFIG_SETRTFLAG
(
CONFIG_NOEXITONHELP
);
get_common_options
(
SOFTMODEM_GNB_BIT
);
config_process_cmdline
(
cmdline_params
,
sizeof
(
cmdline_params
)
/
sizeof
(
paramdef_t
),
NULL
);
config_process_cmdline
(
cmdline_params
,
sizeof
(
cmdline_params
)
/
sizeof
(
paramdef_t
),
NULL
);
CONFIG_CLEARRTFLAG
(
CONFIG_NOEXITONHELP
);
...
@@ -817,7 +820,6 @@ int main( int argc, char **argv )
...
@@ -817,7 +820,6 @@ int main( int argc, char **argv )
configure_linux
();
configure_linux
();
printf
(
"Reading in command-line options
\n
"
);
printf
(
"Reading in command-line options
\n
"
);
get_options
();
get_options
();
get_common_options
(
SOFTMODEM_GNB_BIT
);
if
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
)
)
{
if
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
)
)
{
fprintf
(
stderr
,
"Getting configuration failed
\n
"
);
fprintf
(
stderr
,
"Getting configuration failed
\n
"
);
...
@@ -959,14 +961,14 @@ if(!IS_SOFTMODEM_NOS1)
...
@@ -959,14 +961,14 @@ if(!IS_SOFTMODEM_NOS1)
printf
(
"RC.nb_RU:%d
\n
"
,
RC
.
nb_RU
);
printf
(
"RC.nb_RU:%d
\n
"
,
RC
.
nb_RU
);
// once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
// once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
printf
(
"ALL RUs ready - init gNBs
\n
"
);
printf
(
"ALL RUs ready - init gNBs
\n
"
);
if
(
IS_SOFTMODEM_DOFORMS
)
{
if
(
do_forms
==
1
)
{
scopeParms_t
p
;
scopeParms_t
p
;
p
.
argc
=&
argc
;
p
.
argc
=&
argc
;
p
.
argv
=
argv
;
p
.
argv
=
argv
;
p
.
gNB
=
RC
.
gNB
[
0
];
p
.
gNB
=
RC
.
gNB
[
0
];
p
.
ru
=
RC
.
ru
[
0
];
p
.
ru
=
RC
.
ru
[
0
];
gNBinitScope
(
&
p
);
load_softscope
(
"nr"
,
&
p
);
}
}
if
(
nfapi_mode
!=
1
&&
nfapi_mode
!=
2
)
{
if
(
nfapi_mode
!=
1
&&
nfapi_mode
!=
2
)
{
...
...
executables/nr-softmodem.h
View file @
470ecad2
...
@@ -19,21 +19,12 @@
...
@@ -19,21 +19,12 @@
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_PARAMS_DESC_GNB { \
#define CMDLINE_PARAMS_DESC_GNB { \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:DEFAULT_DLF, TYPE_UINT64, 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}, \
{"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}, \
{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 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}, \
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
}
}
...
...
executables/nr-uesoftmodem.c
View file @
470ecad2
...
@@ -78,6 +78,9 @@ unsigned short config_frames[4] = {2,9,11,13};
...
@@ -78,6 +78,9 @@ unsigned short config_frames[4] = {2,9,11,13};
/* Callbacks, globals and object handlers */
/* Callbacks, globals and object handlers */
//#include "stats.h"
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
#include "PHY/TOOLS/phy_scope_interface.h"
#include "PHY/TOOLS/nr_phy_scope.h"
#include "PHY/TOOLS/nr_phy_scope.h"
#include <executables/nr-uesoftmodem.h>
#include <executables/nr-uesoftmodem.h>
#include "executables/softmodem-common.h"
#include "executables/softmodem-common.h"
...
@@ -148,14 +151,11 @@ char ref[128] = "internal";
...
@@ -148,14 +151,11 @@ char ref[128] = "internal";
char
channels
[
128
]
=
"0"
;
char
channels
[
128
]
=
"0"
;
static
char
*
parallel_config
=
NULL
;
static
char
*
worker_config
=
NULL
;
int
rx_input_level_dBm
;
int
rx_input_level_dBm
;
//static int online_log_messages=0;
//static int online_log_messages=0;
uint32_t
do_forms
=
0
;
int
otg_enabled
;
int
otg_enabled
;
//int number_of_cards = 1;
//int number_of_cards = 1;
...
@@ -758,8 +758,10 @@ int main( int argc, char **argv ) {
...
@@ -758,8 +758,10 @@ int main( int argc, char **argv ) {
memset
(
&
UE_PF_PO
[
0
][
0
],
0
,
sizeof
(
UE_PF_PO_t
)
*
NUMBER_OF_UE_MAX
*
MAX_NUM_CCs
);
memset
(
&
UE_PF_PO
[
0
][
0
],
0
,
sizeof
(
UE_PF_PO_t
)
*
NUMBER_OF_UE_MAX
*
MAX_NUM_CCs
);
configure_linux
();
configure_linux
();
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
);
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
);
if
(
do_forms
)
nrUEinitScope
(
PHY_vars_UE_g
[
0
][
0
]);
if
(
IS_SOFTMODEM_DOFORMS
)
{
load_softscope
(
"nr"
,
PHY_vars_UE_g
[
0
][
0
]);
}
number_of_cards
=
1
;
number_of_cards
=
1
;
for
(
int
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
for
(
int
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
...
...
executables/nr-uesoftmodem.h
View file @
470ecad2
...
@@ -61,19 +61,11 @@
...
@@ -61,19 +61,11 @@
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:0,TYPE_UINT64, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:&do_forms, defintval:0, TYPE_INT, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, iptr:&threequarter_fs, defintval:0, TYPE_INT, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, iptr:&threequarter_fs, defintval:0, TYPE_INT, 0}, \
{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 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}, \
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
{"numerology" , CONFIG_HLP_NUMEROLOGY, 0, iptr:&numerology, defintval:0, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0}, \
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0, TYPE_INT, 0}, \
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0, TYPE_INT, 0}, \
...
...
openair1/PHY/TOOLS/nr_phy_scope.c
View file @
470ecad2
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include "nr_phy_scope.h"
#include "nr_phy_scope.h"
#include "executables/nr-softmodem-common.h"
#include "executables/nr-softmodem-common.h"
#include "executables/softmodem-common.h"
#include <forms.h>
#include <forms.h>
#define TPUT_WINDOW_LENGTH 100
#define TPUT_WINDOW_LENGTH 100
...
@@ -768,6 +769,15 @@ void nrUEinitScope(PHY_VARS_NR_UE *ue) {
...
@@ -768,6 +769,15 @@ void nrUEinitScope(PHY_VARS_NR_UE *ue) {
threadCreate
(
&
forms_thread
,
nrUEscopeThread
,
ue
,
"scope"
,
-
1
,
OAI_PRIORITY_RT_LOW
);
threadCreate
(
&
forms_thread
,
nrUEscopeThread
,
ue
,
"scope"
,
-
1
,
OAI_PRIORITY_RT_LOW
);
}
}
void
nrscope_autoinit
(
void
*
dataptr
)
{
AssertFatal
(
(
IS_SOFTMODEM_GNB_BIT
||
IS_SOFTMODEM_5GUE_BIT
),
"Scope cannot find NRUE or GNB context"
);
if
(
IS_SOFTMODEM_GNB_BIT
)
gNBinitScope
(
dataptr
);
else
nrUEinitScope
(
dataptr
);
}
// Kept to put back the functionality soon
// Kept to put back the functionality soon
#if 0
#if 0
//FD_stats_form *form_stats=NULL,*form_stats_l2=NULL;
//FD_stats_form *form_stats=NULL,*form_stats_l2=NULL;
...
@@ -795,6 +805,8 @@ static void reset_stats_gNB(FL_OBJECT *button,
...
@@ -795,6 +805,8 @@ static void reset_stats_gNB(FL_OBJECT *button,
}
}
}
}
static FD_stats_form *create_form_stats_form(int ID) {
static FD_stats_form *create_form_stats_form(int ID) {
FL_OBJECT *obj;
FL_OBJECT *obj;
FD_stats_form *fdui = calloc(( sizeof *fdui ),1);
FD_stats_form *fdui = calloc(( sizeof *fdui ),1);
...
...
openair1/PHY/TOOLS/nr_phy_scope.h
View file @
470ecad2
...
@@ -40,8 +40,6 @@ typedef struct {
...
@@ -40,8 +40,6 @@ typedef struct {
PHY_VARS_gNB
*
gNB
;
PHY_VARS_gNB
*
gNB
;
}
scopeParms_t
;
}
scopeParms_t
;
void
gNBinitScope
(
scopeParms_t
*
p
);
void
nrUEinitScope
(
PHY_VARS_NR_UE
*
ue
);
extern
RAN_CONTEXT_t
RC
;
extern
RAN_CONTEXT_t
RC
;
#endif
#endif
openair1/PHY/TOOLS/phy_scope_interface.c
View file @
470ecad2
...
@@ -37,10 +37,10 @@
...
@@ -37,10 +37,10 @@
#define SOFTSCOPE_ENDFUNC_IDX 0
#define SOFTSCOPE_ENDFUNC_IDX 0
static
loader_shlibfunc_t
scope_fdesc
[]
=
{{
"end_forms"
,
NULL
}};
static
loader_shlibfunc_t
scope_fdesc
[]
=
{{
"end_forms"
,
NULL
}};
int
load_softscope
(
char
*
exectype
)
{
int
load_softscope
(
char
*
exectype
,
void
*
initarg
)
{
char
libname
[
64
];
char
libname
[
64
];
sprintf
(
libname
,
"%.10sscope"
,
exectype
);
sprintf
(
libname
,
"%.10sscope"
,
exectype
);
return
load_module_shlib
(
libname
,
scope_fdesc
,
1
,
NULL
);
return
load_module_shlib
(
libname
,
scope_fdesc
,
1
,
initarg
);
}
}
int
end_forms
(
void
)
{
int
end_forms
(
void
)
{
...
...
openair1/PHY/TOOLS/phy_scope_interface.h
View file @
470ecad2
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
*/
*/
int
load_softscope
(
char
*
exectype
);
int
load_softscope
(
char
*
exectype
,
void
*
initarg
);
int
end_forms
(
void
)
;
int
end_forms
(
void
)
;
openair1/SIMULATION/TOOLS/random_channel.c
View file @
470ecad2
This diff is collapsed.
Click to expand it.
openair1/SIMULATION/TOOLS/sim.h
View file @
470ecad2
...
@@ -40,6 +40,16 @@ The present clause specifies several numerical functions for testing of digital
...
@@ -40,6 +40,16 @@ The present clause specifies several numerical functions for testing of digital
#define NB_SAMPLES_CHANNEL_OFFSET 4
#define NB_SAMPLES_CHANNEL_OFFSET 4
typedef
enum
{
UNSPECIFIED_MODID
=
0
,
RFSIMU_MODULEID
=
1
}
channelmod_moduleid_t
;
#define MODULEID_STR_INIT {"","rfsimulator"}
#define CHANMODEL_FREE_DELAY 1<<0
#define CHANMODEL_FREE_RSQRT_6 1<<1
#define CHANMODEL_FREE_RSQRT_NTAPS 1<<2
#define CHANMODEL_FREE_AMPS 1<<3
typedef
struct
{
typedef
struct
{
///Number of tx antennas
///Number of tx antennas
uint8_t
nb_tx
;
uint8_t
nb_tx
;
...
@@ -92,6 +102,14 @@ typedef struct {
...
@@ -92,6 +102,14 @@ typedef struct {
time_stats_t
interp_time
;
time_stats_t
interp_time
;
time_stats_t
interp_freq
;
time_stats_t
interp_freq
;
time_stats_t
convolution
;
time_stats_t
convolution
;
/// index in the channel descriptors array
unsigned
int
chan_idx
;
/// id of the channel modeling algorithm
int
modelid
;
/// identifies channel descriptor owner (the module which created this descriptor)
channelmod_moduleid_t
module_id
;
/// flags to properly trigger memory free
unsigned
int
free_flags
;
}
channel_desc_t
;
}
channel_desc_t
;
typedef
struct
{
typedef
struct
{
...
@@ -214,8 +232,9 @@ typedef enum {
...
@@ -214,8 +232,9 @@ typedef enum {
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CHANNELMOD_SECTION "channelmod"
#define CHANNELMOD_SECTION "channelmod"
#define CHANNELMOD_PARAMS_DESC { \
#define CHANNELMOD_PARAMS_DESC { \
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB , defdblval:25, TYPE_DOUBLE, 0},\
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\
{"sinr_dB", NULL , 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
{"sinr_dB", NULL, 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
{"max_chan, CONFIG_HLP_MAX_CHAN", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\
}
}
#include "platform_constants.h"
#include "platform_constants.h"
...
@@ -273,9 +292,18 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
...
@@ -273,9 +292,18 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
double
forgetting_factor
,
double
forgetting_factor
,
int32_t
channel_offset
,
int32_t
channel_offset
,
double
path_loss_dB
);
double
path_loss_dB
);
/**
\brief free memory allocated for a model descriptor
\param ch points to the model, which cannot be used after calling this fuction
*/
void
free_channel_desc_scm
(
channel_desc_t
*
ch
);
/**
\brief This set the ownerid of a model descriptor, can be later used to check what module created a channel model
\param cdesc points to the model descriptor
\param module_id identifies the channel model. should be define as a macro in simu.h
*/
void
set_channeldesc_owner
(
channel_desc_t
*
cdesc
,
channelmod_moduleid_t
module_id
);
/** \fn void random_channel(channel_desc_t *desc)
/** \fn void random_channel(channel_desc_t *desc)
\brief This routine generates a random channel response (time domain) according to a tapped delay line model.
\brief This routine generates a random channel response (time domain) according to a tapped delay line model.
\param desc Pointer to the channel descriptor
\param desc Pointer to the channel descriptor
...
...
targets/ARCH/rfsimulator/simulator.c
View file @
470ecad2
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
#include <common/utils/assertions.h>
#include <common/utils/assertions.h>
#include <common/utils/LOG/log.h>
#include <common/utils/LOG/log.h>
#include <common/utils/load_module_shlib.h>
#include <common/utils/load_module_shlib.h>
#include <common/utils/telnetsrv/telnetsrv.h>
#include <common/config/config_userapi.h>
#include <common/config/config_userapi.h>
#include "common_lib.h"
#include "common_lib.h"
#include <openair1/PHY/defs_eNB.h>
#include <openair1/PHY/defs_eNB.h>
...
@@ -78,11 +79,25 @@ extern RAN_CONTEXT_t RC;
...
@@ -78,11 +79,25 @@ extern RAN_CONTEXT_t RC;
#define RFSIMULATOR_PARAMS_DESC {\
#define RFSIMULATOR_PARAMS_DESC {\
{"serveraddr", "<ip address to connect to>\n", 0, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\
{"serveraddr", "<ip address to connect to>\n", 0, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\
{"serverport", "<port to connect to>\n", 0, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\
{"serverport", "<port to connect to>\n", 0, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0},\
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0
},\
{"IQfile", "<file path to use when saving IQs>\n", 0, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\
{"IQfile", "<file path to use when saving IQs>\n", 0, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\
{"modelname", "<channel model name>\n", 0, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 }\
{"modelname", "<channel model name>\n", 0, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\
{"ploss", "<channel path loss in dB>\n", 0, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\
{"forgetfact", "<channel forget factor ((0 to 1)>\n", 0, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\
{"offset", "<channel offset in samps>\n", 0, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\
};
};
static
int
rfsimu_setchanmod_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
,
void
*
arg
);
static
telnetshell_cmddef_t
rfsimu_cmdarray
[]
=
{
{
"setmodel"
,
"<model name>"
,(
cmdfunc_t
)
rfsimu_setchanmod_cmd
,
TELNETSRV_CMDFLAG_PUSHINTPOOLQ
},
{
""
,
""
,
NULL
},
};
static
telnetshell_vardef_t
rfsimu_vardef
[]
=
{
{
""
,
0
,
NULL
}
};
pthread_mutex_t
Sockmutex
;
pthread_mutex_t
Sockmutex
;
typedef
struct
complex16
sample_t
;
// 2*16 bits complex number
typedef
struct
complex16
sample_t
;
// 2*16 bits complex number
...
@@ -114,6 +129,11 @@ typedef struct {
...
@@ -114,6 +129,11 @@ typedef struct {
double
sample_rate
;
double
sample_rate
;
double
tx_bw
;
double
tx_bw
;
int
channelmod
;
int
channelmod
;
double
chan_pathloss
;
double
chan_forgetfact
;
int
chan_offset
;
void
*
telnetcmd_qid
;
poll_telnetcmdq_func_t
poll_telnetcmdq
;
}
rfsimulator_state_t
;
}
rfsimulator_state_t
;
...
@@ -150,11 +170,11 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
...
@@ -150,11 +170,11 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
static
bool
init_done
=
false
;
static
bool
init_done
=
false
;
if
(
!
init_done
)
{
if
(
!
init_done
)
{
uint64_t
rand
;
uint64_t
rand
;
FILE
*
h
=
fopen
(
"/dev/random"
,
"r"
);
FILE
*
h
=
fopen
(
"/dev/random"
,
"r"
);
if
(
1
!=
fread
(
&
rand
,
sizeof
(
rand
),
1
,
h
)
)
if
(
1
!=
fread
(
&
rand
,
sizeof
(
rand
),
1
,
h
)
)
LOG_W
(
HW
,
"Simulator can't read /dev/random
\n
"
);
LOG_W
(
HW
,
"Simulator can't read /dev/random
\n
"
);
fclose
(
h
);
fclose
(
h
);
randominit
(
rand
);
randominit
(
rand
);
tableNor
(
rand
);
tableNor
(
rand
);
init_done
=
true
;
init_done
=
true
;
...
@@ -164,9 +184,10 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
...
@@ -164,9 +184,10 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
bridge
->
channelmod
,
bridge
->
channelmod
,
bridge
->
sample_rate
,
bridge
->
sample_rate
,
bridge
->
tx_bw
,
bridge
->
tx_bw
,
0
.
0
,
// forgetting_factor
bridge
->
chan_forgetfact
,
// forgetting_factor
0
,
// maybe used for TA
bridge
->
chan_offset
,
// maybe used for TA
0
);
// path_loss in dB
bridge
->
chan_pathloss
);
// path_loss in dB
set_channeldesc_owner
(
ptr
->
channel_model
,
RFSIMU_MODULEID
);
random_channel
(
ptr
->
channel_model
,
false
);
random_channel
(
ptr
->
channel_model
,
false
);
}
}
}
}
...
@@ -293,6 +314,41 @@ void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
...
@@ -293,6 +314,41 @@ void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
rfsimulator
->
typeStamp
=
UE_MAGICDL_FDD
;
rfsimulator
->
typeStamp
=
UE_MAGICDL_FDD
;
}
}
static
int
rfsimu_setchanmod_cmd
(
char
*
buff
,
int
debug
,
telnet_printfunc_t
prnt
,
void
*
arg
)
{
char
*
modelname
=
NULL
;
int
s
=
sscanf
(
buff
,
"%ms
\n
"
,
&
modelname
);
if
(
s
==
1
)
{
int
channelmod
=
modelid_fromname
(
modelname
);
if
(
channelmod
<
0
)
prnt
(
"ERROR: model %s unknown
\n
"
,
modelname
);
else
{
rfsimulator_state_t
*
t
=
(
rfsimulator_state_t
*
)
arg
;
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
{
buffer_t
*
b
=&
t
->
buf
[
i
];
if
(
b
->
conn_sock
>=
0
)
{
channel_desc_t
*
newmodel
=
new_channel_desc_scm
(
t
->
tx_num_channels
,
t
->
rx_num_channels
,
channelmod
,
t
->
sample_rate
,
t
->
tx_bw
,
t
->
chan_forgetfact
,
// forgetting_factor
t
->
chan_offset
,
// maybe used for TA
t
->
chan_pathloss
);
// path_loss in dB
set_channeldesc_owner
(
newmodel
,
RFSIMU_MODULEID
);
random_channel
(
newmodel
,
false
);
channel_desc_t
*
oldmodel
=
b
->
channel_model
;
b
->
channel_model
=
newmodel
;
free_channel_desc_scm
(
oldmodel
);
prnt
(
"New model %s applied to channel connected to sock %d
\n
"
,
modelname
,
i
);
}
}
}
}
else
{
prnt
(
"ERROR: no model specified
\n
"
);
}
free
(
modelname
);
return
CMDSTATUS_FOUND
;
}
int
server_start
(
openair0_device
*
device
)
{
int
server_start
(
openair0_device
*
device
)
{
rfsimulator_state_t
*
t
=
(
rfsimulator_state_t
*
)
device
->
priv
;
rfsimulator_state_t
*
t
=
(
rfsimulator_state_t
*
)
device
->
priv
;
t
->
typeStamp
=
ENB_MAGICDL_FDD
;
t
->
typeStamp
=
ENB_MAGICDL_FDD
;
...
@@ -647,7 +703,8 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
...
@@ -647,7 +703,8 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
// it seems legacy behavior is: never in UL, each frame in DL
// it seems legacy behavior is: never in UL, each frame in DL
if
(
reGenerateChannel
)
if
(
reGenerateChannel
)
random_channel
(
ptr
->
channel_model
,
0
);
random_channel
(
ptr
->
channel_model
,
0
);
if
(
t
->
poll_telnetcmdq
)
t
->
poll_telnetcmdq
(
t
->
telnetcmd_qid
,
t
);
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
if
(
ptr
->
channel_model
!=
NULL
)
// apply a channel model
if
(
ptr
->
channel_model
!=
NULL
)
// apply a channel model
rxAddInput
(
ptr
->
circularBuf
,
(
struct
complex16
*
)
samplesVoid
[
a
],
rxAddInput
(
ptr
->
circularBuf
,
(
struct
complex16
*
)
samplesVoid
[
a
],
...
@@ -742,5 +799,18 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
...
@@ -742,5 +799,18 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
rfsimulator
->
tx_bw
=
openair0_cfg
->
tx_bw
;
rfsimulator
->
tx_bw
=
openair0_cfg
->
tx_bw
;
//randominit(0);
//randominit(0);
set_taus_seed
(
0
);
set_taus_seed
(
0
);
/* look for telnet server, if it is loaded, add the channel modeling commands to it */
add_telnetcmd_func_t
addcmd
=
(
add_telnetcmd_func_t
)
get_shlibmodule_fptr
(
"telnetsrv"
,
TELNET_ADDCMD_FNAME
);
if
(
addcmd
!=
NULL
)
{
rfsimulator
->
poll_telnetcmdq
=
(
poll_telnetcmdq_func_t
)
get_shlibmodule_fptr
(
"telnetsrv"
,
TELNET_POLLCMDQ_FNAME
);
addcmd
(
"rfsimu"
,
rfsimu_vardef
,
rfsimu_cmdarray
);
for
(
int
i
=
0
;
rfsimu_cmdarray
[
i
].
cmdfunc
!=
NULL
;
i
++
)
{
if
(
rfsimu_cmdarray
[
i
].
qptr
!=
NULL
)
{
rfsimulator
->
telnetcmd_qid
=
rfsimu_cmdarray
[
i
].
qptr
;
break
;
}
}
}
return
0
;
return
0
;
}
}
targets/RT/USER/lte-softmodem.c
View file @
470ecad2
...
@@ -727,7 +727,7 @@ int main ( int argc, char **argv )
...
@@ -727,7 +727,7 @@ int main ( int argc, char **argv )
// end of CI modifications
// end of CI modifications
//getchar();
//getchar();
if
(
IS_SOFTMODEM_DOFORMS
)
if
(
IS_SOFTMODEM_DOFORMS
)
load_softscope
(
"enb"
);
load_softscope
(
"enb"
,
NULL
);
itti_wait_tasks_end
();
itti_wait_tasks_end
();
oai_exit
=
1
;
oai_exit
=
1
;
LOG_I
(
ENB_APP
,
"oai_exit=%d
\n
"
,
oai_exit
);
LOG_I
(
ENB_APP
,
"oai_exit=%d
\n
"
,
oai_exit
);
...
...
targets/RT/USER/lte-uesoftmodem.c
View file @
470ecad2
...
@@ -759,7 +759,7 @@ int main( int argc, char **argv ) {
...
@@ -759,7 +759,7 @@ int main( int argc, char **argv ) {
}
}
if
(
IS_SOFTMODEM_DOFORMS
)
if
(
IS_SOFTMODEM_DOFORMS
)
load_softscope
(
"ue"
);
load_softscope
(
"ue"
,
NULL
);
config_check_unknown_cmdlineopt
(
CONFIG_CHECKALLSECTIONS
);
config_check_unknown_cmdlineopt
(
CONFIG_CHECKALLSECTIONS
);
printf
(
"Sending sync to all threads (%p,%p,%p)
\n
"
,
&
sync_var
,
&
sync_cond
,
&
sync_mutex
);
printf
(
"Sending sync to all threads (%p,%p,%p)
\n
"
,
&
sync_var
,
&
sync_cond
,
&
sync_mutex
);
...
...
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