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
canghaiwuhen
OpenXG-RAN
Commits
10a3565d
Commit
10a3565d
authored
Dec 09, 2019
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usrp device cleanup, record player as run-time option
parent
81933116
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
350 additions
and
447 deletions
+350
-447
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+4
-2
cmake_targets/build_oai
cmake_targets/build_oai
+1
-1
common/config/config_userapi.c
common/config/config_userapi.c
+3
-3
openair2/COMMON/platform_types.h
openair2/COMMON/platform_types.h
+8
-1
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+277
-426
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
+56
-13
targets/RT/USER/lte-ru.c
targets/RT/USER/lte-ru.c
+1
-1
No files found.
cmake_targets/CMakeLists.txt
View file @
10a3565d
...
...
@@ -186,7 +186,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
# these changes are related to hardcoded path to include .h files
set
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS
}
-g3 -DMALLOC_CHECK_=3"
)
set
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"
${
CMAKE_C_FLAGS
}
-g3 -DMALLOC_CHECK_=3 -O2"
)
set
(
CMAKE_C_FLAGS_RELEASE
"
${
CMAKE_C_FLAGS
}
-O3"
)
set
(
GIT_BRANCH
"UNKNOWN"
)
set
(
GIT_COMMIT_HASH
"UNKNOWN"
)
...
...
@@ -531,7 +531,9 @@ foreach(USRPSOURCE ${USRPSRCVARIANT})
# )
get_filename_component
(
USRPVERSION
${
USRPSOURCE
}
NAME_WE
)
string
(
REPLACE
"usrp_lib"
""
USRPVERSION
${
USRPVERSION
}
)
add_library
(
oai_usrpdevif
${
USRPVERSION
}
MODULE
${
USRPSOURCE
}
)
add_library
(
oai_usrpdevif
${
USRPVERSION
}
MODULE
${
USRPSOURCE
}
${
OPENAIR_TARGETS
}
/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
)
target_link_libraries
(
oai_usrpdevif
${
USRPVERSION
}
uhd
)
endforeach
(
USRPSOURCE
)
...
...
cmake_targets/build_oai
View file @
10a3565d
...
...
@@ -223,7 +223,7 @@ function main() {
CMAKE_BUILD_TYPE
=
"Debug"
echo_info
"Will Compile with gdb symbols and disable compiler optimization"
CMAKE_CMD
=
"
$CMAKE_CMD
-DCMAKE_BUILD_TYPE=Debug"
if
[
"
$
1
"
==
"Debug"
]
;
then
if
[
"
$
2
"
==
"Debug"
]
;
then
shift
fi
;;
...
...
common/config/config_userapi.c
View file @
10a3565d
...
...
@@ -386,13 +386,13 @@ int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
status
=
1
;
if
(
cfgoptions
->
numelt
==
0
)
{
config_check_valptr
(
cfgoptions
,
(
char
**
)(
cfgoptions
->
strptr
),
sizeof
(
char
*
));
//
config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
config_check_valptr
(
cfgoptions
,
cfgoptions
->
strptr
,
strlen
(
cfgoptions
->
defstrval
)
+
1
);
sprintf
(
*
(
cfgoptions
->
strptr
),
"%s"
,
cfgoptions
->
defstrval
);
printf_params
(
"[CONFIG] %s.%s set to default value
\"
%s
\"\n
"
,
((
prefix
==
NULL
)
?
""
:
prefix
),
cfgoptions
->
optname
,
*
(
cfgoptions
->
strptr
));
}
else
{
sprintf
((
char
*
)
*
(
cfgoptions
->
strptr
),
"%s"
,
cfgoptions
->
defstrval
);
printf_params
(
"[CONFIG] %s.%s set to default value
\"
%s
\"\n
"
,
((
prefix
==
NULL
)
?
""
:
prefix
),
cfgoptions
->
optname
,
(
char
*
)
*
(
cfgoptions
->
strptr
));
sprintf
((
char
*
)(
cfgoptions
->
strptr
),
"%s"
,
cfgoptions
->
defstrval
);
printf_params
(
"[CONFIG] %s.%s set to default value
\"
%s
\"\n
"
,
((
prefix
==
NULL
)
?
""
:
prefix
),
cfgoptions
->
optname
,
(
char
*
)(
cfgoptions
->
strptr
));
}
}
...
...
openair2/COMMON/platform_types.h
View file @
10a3565d
...
...
@@ -302,5 +302,12 @@ typedef struct protocol_ctxt_s {
#define CHECK_CTXT_ARGS(CTXT_Pp)
#define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg)
#ifdef __cplusplus
extern
"C"
{
#endif
void
exit_function
(
const
char
*
file
,
const
char
*
function
,
const
int
line
,
const
char
*
s
);
#ifdef __cplusplus
}
#endif
#endif
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
10a3565d
This diff is collapsed.
Click to expand it.
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
View file @
10a3565d
...
...
@@ -26,8 +26,6 @@
* \author: bruno.mongazon-cazavet@nokia-bell-labs.com
*/
#if defined (USRP_REC_PLAY)
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
...
...
@@ -35,6 +33,29 @@
#include "common/config/config_paramdesc.h"
#include "common/config/config_userapi.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define CONFIG_OPT_RECPLAY "enable_recplay"
#define CONFIG_HLP_RECPLAY "Allow record player"
#define USRP_SECTION "device.usrp"
/* inclusion for device configuration */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for USRP record/playback */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define USRP_DEVICE_PARAMS_DESC { \
{CONFIG_OPT_RECPLAY, CONFIG_HLP_RECPLAY, PARAMFLAG_BOOL, uptr:&enable_recplay, defuintval:0, TYPE_UINT, 0} \
}
/* inclusions for record player */
#define RECPLAY_DISABLED 0
#define RECPLAY_RECORDMODE 1
#define RECPLAY_REPLAYMODE 2
#define BELL_LABS_IQ_HEADER 0xabababababababab
#define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now
#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
...
...
@@ -46,13 +67,13 @@ typedef struct {
unsigned
char
samples
[
BELL_LABS_IQ_BYTES_PER_SF
];
// iq's for one subframe
}
iqrec_t
;
#define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz)
#define DEF_SF_FILE "/
home/nokia/iqfile"
// default subframes file name
#define DEF_SF_FILE "/
tmp/iqfile"
// default subframes file name
#define DEF_SF_DELAY_READ 700 // default read delay µs (860=real)
#define DEF_SF_DELAY_WRITE 15 // default write delay µs (15=real)
#define DEF_SF_NB_LOOP 5 // default nb loops
/* help strings definition for co
mmand line
options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
/* help strings definition for co
nfig
options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
#define CONFIG_HLP_SF_FILE "Path of the file used for subframes record or replay"
#define CONFIG_HLP_SF_REC "Record subframes from USRP driver into a file for later replay"
#define CONFIG_HLP_SF_REP "Replay subframes into USRP driver from a file"
...
...
@@ -61,7 +82,7 @@ typedef struct {
#define CONFIG_HLP_SF_RDELAY "Delay in microseconds to read a subframe in replay mode"
#define CONFIG_HLP_SF_WDELAY "Delay in microseconds to write a subframe in replay mode"
/* keyword strings for co
mmand line
options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
/* keyword strings for co
nfig
options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
#define CONFIG_OPT_SF_FILE "subframes-file"
#define CONFIG_OPT_SF_REC "subframes-record"
#define CONFIG_OPT_SF_REP "subframes-replay"
...
...
@@ -70,20 +91,42 @@ typedef struct {
#define CONFIG_OPT_SF_RDELAY "subframes-read-delay"
#define CONFIG_OPT_SF_WDELAY "subframes-write-delay"
#define USRP_RECPLAY_SECTION "device.recplay"
/* For information only - the macro is not usable in C++ */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for USRP record/playback */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define USRP_RECPLAY_PARAMS_DESC { \
{"subframes-file", CONFIG_HLP_SF_FILE, 0, strptr:(char **)&u_sf_filename, defstrval:DEF_SF_FILE, TYPE_STRING, sizeof(u_sf_filename)}, \
{"subframes-record", CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&u_sf_record, defuintval:0, TYPE_UINT, 0}, \
{"subframes-replay", CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&u_sf_replay, defuintval:0, TYPE_UINT, 0}, \
{"subframes-max", CONFIG_HLP_SF_MAX, 0, uptr:&u_sf_max, defintval:DEF_NB_SF, TYPE_UINT, 0}, \
{"subframes-loops", CONFIG_HLP_SF_LOOPS, 0, uptr:&u_sf_loops, defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \
{"subframes-read-delay", CONFIG_HLP_SF_RDELAY, 0, uptr:&u_sf_read_delay, defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \
{"subframes-write-delay", CONFIG_HLP_SF_WDELAY, 0, uptr:&u_sf_write_delay, defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:(char **)((*recplay_state)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 1024}, \
{CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&(u_sf_record), defuintval:0, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&(u_sf_replay), defuintval:0, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_MAX, CONFIG_HLP_SF_MAX, 0, uptr:&((*recplay_state)->u_sf_max), defintval:DEF_NB_SF, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_LOOPS, CONFIG_HLP_SF_LOOPS, 0, uptr:&((*recplay_state)->u_sf_loops), defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_RDELAY, CONFIG_HLP_SF_RDELAY, 0, uptr:&((*recplay_state)->u_sf_read_delay), defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \
{CONFIG_OPT_SF_WDELAY, CONFIG_HLP_SF_WDELAY, 0, uptr:&((*recplay_state)->u_sf_write_delay), defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \
}
/*! \brief USRP Configuration and state */
typedef
struct
{
FILE
*
pFile
;
int
mmapfd
;
int
iqfd
;
int
use_mmap
;
// default is to use mmap
size_t
mapsize
;
iqrec_t
*
ms_sample
;
// memory for all subframes
unsigned
int
nb_samples
;
unsigned
int
u_sf_mode
;
// 1=record, 2=replay
char
u_sf_filename
[
1024
];
// subframes file path
unsigned
int
u_sf_max
;
// max number of recorded subframes
unsigned
int
u_sf_loops
;
// number of loops in replay mode
unsigned
int
u_sf_read_delay
;
// read delay in replay mode
unsigned
int
u_sf_write_delay
;
// write delay in replay mode
}
recplay_state_t
;
extern
int
read_usrpconfig
(
uint32_t
*
recplay_mode
,
recplay_state_t
**
recplay_state
);
#ifdef __cplusplus
}
#endif
// BELL_LABS_MUST
#endif
#endif // __USRP_LIB_H
targets/RT/USER/lte-ru.c
View file @
10a3565d
...
...
@@ -1320,7 +1320,7 @@ static inline int wakeup_prach_ru(RU_t *ru) {
}
inline
int
wakeup_prach_ru_br
(
RU_t
*
ru
)
{
static
inline
int
wakeup_prach_ru_br
(
RU_t
*
ru
)
{
int
ret
;
struct
timespec
wait
;
int
time_ns
=
5000000L
;
...
...
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