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
Michael Black
OpenXG-RAN
Commits
2f66c11d
Commit
2f66c11d
authored
Sep 24, 2018
by
Wang Tsu-Han
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding emulate-rf feature in nr
parent
dbb42319
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
40 deletions
+103
-40
targets/RT/USER/nr-ru.c
targets/RT/USER/nr-ru.c
+99
-39
targets/RT/USER/nr-softmodem.c
targets/RT/USER/nr-softmodem.c
+1
-1
targets/RT/USER/nr-softmodem.h
targets/RT/USER/nr-softmodem.h
+3
-0
No files found.
targets/RT/USER/nr-ru.c
View file @
2f66c11d
...
...
@@ -151,6 +151,9 @@ int connect_rau(RU_t *ru);
extern
uint16_t
sf_ahead
;
extern
int
emulate_rf
;
extern
int
numerology
;
/*************************************************************/
/* Functions to attach and configure RRU */
...
...
@@ -686,6 +689,34 @@ void fh_if4p5_north_out(RU_t *ru) {
}
static
void
*
emulatedRF_thread
(
void
*
param
)
{
RU_proc_t
*
proc
=
(
RU_proc_t
*
)
param
;
int
microsec
=
500
;
// length of time to sleep, in miliseconds
struct
timespec
req
=
{
0
};
req
.
tv_sec
=
0
;
req
.
tv_nsec
=
(
numerology
>
0
)
?
((
microsec
*
1000L
)
/
numerology
)
:
(
microsec
*
1000L
)
*
2
;
cpu_set_t
cpuset
;
CPU_SET
(
1
,
&
cpuset
);
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
int
policy
;
struct
sched_param
sparam
;
memset
(
&
sparam
,
0
,
sizeof
(
sparam
));
sparam
.
sched_priority
=
sched_get_priority_max
(
SCHED_FIFO
);
policy
=
SCHED_FIFO
;
pthread_setschedparam
(
pthread_self
(),
policy
,
&
sparam
);
wait_sync
(
"emulatedRF_thread"
);
while
(
!
oai_exit
){
nanosleep
(
&
req
,
(
struct
timespec
*
)
NULL
);
pthread_mutex_lock
(
&
proc
->
mutex_emulateRF
);
++
proc
->
instance_cnt_emulateRF
;
pthread_mutex_unlock
(
&
proc
->
mutex_emulateRF
);
pthread_cond_signal
(
&
proc
->
cond_emulateRF
);
}
return
0
;
}
void
rx_rf
(
RU_t
*
ru
,
int
*
frame
,
int
*
subframe
)
{
RU_proc_t
*
proc
=
&
ru
->
proc
;
...
...
@@ -702,11 +733,18 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
old_ts
=
proc
->
timestamp_rx
;
rxs
=
ru
->
rfdevice
.
trx_read_func
(
&
ru
->
rfdevice
,
if
(
emulate_rf
){
wait_on_condition
(
&
proc
->
mutex_emulateRF
,
&
proc
->
cond_emulateRF
,
&
proc
->
instance_cnt_emulateRF
,
"emulatedRF_thread"
);
release_thread
(
&
proc
->
mutex_emulateRF
,
&
proc
->
instance_cnt_emulateRF
,
"emulatedRF_thread"
);
rxs
=
fp
->
samples_per_tti
;
}
else
{
rxs
=
ru
->
rfdevice
.
trx_read_func
(
&
ru
->
rfdevice
,
&
ts
,
rxp
,
fp
->
samples_per_subframe
,
ru
->
nb_rx
);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ
,
0
);
...
...
@@ -1377,26 +1415,37 @@ static void* ru_thread( void* param ) {
LOG_I
(
PHY
,
"Starting RU %d (%s,%s),
\n
"
,
ru
->
idx
,
NB_functions
[
ru
->
function
],
NB_timing
[
ru
->
if_timing
]);
// Start IF device if any
if
(
ru
->
start_if
)
{
LOG_I
(
PHY
,
"Starting IF interface for RU %d
\n
"
,
ru
->
idx
);
AssertFatal
(
ru
->
start_if
(
ru
,
NULL
)
==
0
,
"Could not start the IF device
\n
"
);
if
(
ru
->
if_south
==
LOCAL_RF
)
ret
=
connect_rau
(
ru
);
else
ret
=
attach_rru
(
ru
);
AssertFatal
(
ret
==
0
,
"Cannot connect to radio
\n
"
);
}
if
(
ru
->
if_south
==
LOCAL_RF
)
{
// configure RF parameters only
if
(
emulate_rf
){
fill_rf_config
(
ru
,
ru
->
rf_config_file
);
nr_init_frame_parms
(
&
ru
->
gNB_list
[
0
]
->
gNB_config
,
fp
);
nr_dump_frame_parms
(
fp
);
nr_phy_init_RU
(
ru
);
ret
=
openair0_device_load
(
&
ru
->
rfdevice
,
&
ru
->
openair0_cfg
);
if
(
setup_RU_buffers
(
ru
)
!=
0
)
{
printf
(
"Exiting, cannot initialize RU Buffers
\n
"
);
exit
(
-
1
);
}
}
if
(
setup_RU_buffers
(
ru
)
!=
0
)
{
printf
(
"Exiting, cannot initialize RU Buffers
\n
"
);
exit
(
-
1
);
else
{
// Start IF device if any
if
(
ru
->
start_if
)
{
LOG_I
(
PHY
,
"Starting IF interface for RU %d
\n
"
,
ru
->
idx
);
AssertFatal
(
ru
->
start_if
(
ru
,
NULL
)
==
0
,
"Could not start the IF device
\n
"
);
if
(
ru
->
if_south
==
LOCAL_RF
)
ret
=
connect_rau
(
ru
);
else
ret
=
attach_rru
(
ru
);
AssertFatal
(
ret
==
0
,
"Cannot connect to radio
\n
"
);
}
if
(
ru
->
if_south
==
LOCAL_RF
)
{
// configure RF parameters only
fill_rf_config
(
ru
,
ru
->
rf_config_file
);
nr_init_frame_parms
(
&
ru
->
gNB_list
[
0
]
->
gNB_config
,
fp
);
nr_dump_frame_parms
(
fp
);
nr_phy_init_RU
(
ru
);
ret
=
openair0_device_load
(
&
ru
->
rfdevice
,
&
ru
->
openair0_cfg
);
}
if
(
setup_RU_buffers
(
ru
)
!=
0
)
{
printf
(
"Exiting, cannot initialize RU Buffers
\n
"
);
exit
(
-
1
);
}
}
LOG_I
(
PHY
,
"Signaling main thread that RU %d is ready
\n
"
,
ru
->
idx
);
...
...
@@ -1407,28 +1456,30 @@ static void* ru_thread( void* param ) {
wait_sync
(
"ru_thread"
);
// Start RF device if any
if
(
ru
->
start_rf
)
{
if
(
ru
->
start_rf
(
ru
)
!=
0
)
LOG_E
(
HW
,
"Could not start the RF device
\n
"
);
else
LOG_I
(
PHY
,
"RU %d rf device ready
\n
"
,
ru
->
idx
);
}
else
LOG_I
(
PHY
,
"RU %d no rf device
\n
"
,
ru
->
idx
);
if
(
!
emulate_rf
){
// Start RF device if any
if
(
ru
->
start_rf
)
{
if
(
ru
->
start_rf
(
ru
)
!=
0
)
LOG_E
(
HW
,
"Could not start the RF device
\n
"
);
else
LOG_I
(
PHY
,
"RU %d rf device ready
\n
"
,
ru
->
idx
);
}
else
LOG_I
(
PHY
,
"RU %d no rf device
\n
"
,
ru
->
idx
);
// if an asnych_rxtx thread exists
// wakeup the thread because the devices are ready at this point
// if an asnych_rxtx thread exists
// wakeup the thread because the devices are ready at this point
if
((
ru
->
fh_south_asynch_in
)
||
(
ru
->
fh_north_asynch_in
))
{
pthread_mutex_lock
(
&
proc
->
mutex_asynch_rxtx
);
proc
->
instance_cnt_asynch_rxtx
=
0
;
pthread_mutex_unlock
(
&
proc
->
mutex_asynch_rxtx
);
pthread_cond_signal
(
&
proc
->
cond_asynch_rxtx
);
}
else
LOG_I
(
PHY
,
"RU %d no asynch_south interface
\n
"
,
ru
->
idx
);
if
((
ru
->
fh_south_asynch_in
)
||
(
ru
->
fh_north_asynch_in
))
{
pthread_mutex_lock
(
&
proc
->
mutex_asynch_rxtx
);
proc
->
instance_cnt_asynch_rxtx
=
0
;
pthread_mutex_unlock
(
&
proc
->
mutex_asynch_rxtx
);
pthread_cond_signal
(
&
proc
->
cond_asynch_rxtx
);
}
else
LOG_I
(
PHY
,
"RU %d no asynch_south interface
\n
"
,
ru
->
idx
);
// if this is a slave RRU, try to synchronize on the DL frequency
if
((
ru
->
is_slave
)
&&
(
ru
->
if_south
==
LOCAL_RF
))
do_ru_synch
(
ru
);
// if this is a slave RRU, try to synchronize on the DL frequency
if
((
ru
->
is_slave
)
&&
(
ru
->
if_south
==
LOCAL_RF
))
do_ru_synch
(
ru
);
}
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
...
...
@@ -1487,9 +1538,12 @@ static void* ru_thread( void* param ) {
// do OFDM if needed
if
((
ru
->
fh_north_asynch_in
==
NULL
)
&&
(
ru
->
feptx_ofdm
))
ru
->
feptx_ofdm
(
ru
);
// do outgoing fronthaul (south) if needed
if
((
ru
->
fh_north_asynch_in
==
NULL
)
&&
(
ru
->
fh_south_out
))
ru
->
fh_south_out
(
ru
);
if
(
!
emulate_rf
)
{
// do outgoing fronthaul (south) if needed
if
((
ru
->
fh_north_asynch_in
==
NULL
)
&&
(
ru
->
fh_south_out
))
ru
->
fh_south_out
(
ru
);
}
if
(
ru
->
fh_north_out
)
ru
->
fh_north_out
(
ru
);
}
...
...
@@ -1610,7 +1664,7 @@ void init_RU_proc(RU_t *ru) {
int
i
=
0
;
RU_proc_t
*
proc
;
pthread_attr_t
*
attr_FH
=
NULL
,
*
attr_prach
=
NULL
,
*
attr_asynch
=
NULL
;
// *attr_synch=NULL;
pthread_attr_t
*
attr_FH
=
NULL
,
*
attr_prach
=
NULL
,
*
attr_asynch
=
NULL
,
*
attr_emulateRF
=
NULL
;
// *attr_synch=NULL;
//pthread_attr_t *attr_fep=NULL;
#ifdef Rel14
//pthread_attr_t *attr_prach_br=NULL;
...
...
@@ -1628,6 +1682,7 @@ void init_RU_proc(RU_t *ru) {
proc
->
instance_cnt_synch
=
-
1
;
;
proc
->
instance_cnt_FH
=
-
1
;
proc
->
instance_cnt_asynch_rxtx
=
-
1
;
proc
->
instance_cnt_emulateRF
=
-
1
;
proc
->
first_rx
=
1
;
proc
->
first_tx
=
1
;
proc
->
frame_offset
=
0
;
...
...
@@ -1640,15 +1695,18 @@ void init_RU_proc(RU_t *ru) {
pthread_mutex_init
(
&
proc
->
mutex_asynch_rxtx
,
NULL
);
pthread_mutex_init
(
&
proc
->
mutex_synch
,
NULL
);
pthread_mutex_init
(
&
proc
->
mutex_FH
,
NULL
);
pthread_mutex_init
(
&
proc
->
mutex_emulateRF
,
NULL
);
pthread_mutex_init
(
&
proc
->
mutex_gNBs
,
NULL
);
pthread_cond_init
(
&
proc
->
cond_prach
,
NULL
);
pthread_cond_init
(
&
proc
->
cond_FH
,
NULL
);
pthread_cond_init
(
&
proc
->
cond_emulateRF
,
NULL
);
pthread_cond_init
(
&
proc
->
cond_asynch_rxtx
,
NULL
);
pthread_cond_init
(
&
proc
->
cond_synch
,
NULL
);
pthread_cond_init
(
&
proc
->
cond_gNBs
,
NULL
);
pthread_attr_init
(
&
proc
->
attr_FH
);
pthread_attr_init
(
&
proc
->
attr_emulateRF
);
pthread_attr_init
(
&
proc
->
attr_prach
);
pthread_attr_init
(
&
proc
->
attr_synch
);
pthread_attr_init
(
&
proc
->
attr_asynch_rxtx
);
...
...
@@ -1657,13 +1715,15 @@ void init_RU_proc(RU_t *ru) {
#ifndef DEADLINE_SCHEDULER
attr_FH
=
&
proc
->
attr_FH
;
attr_emulateRF
=
&
proc
->
attr_emulateRF
;
attr_prach
=
&
proc
->
attr_prach
;
//attr_synch = &proc->attr_synch;
attr_asynch
=
&
proc
->
attr_asynch_rxtx
;
#endif
pthread_create
(
&
proc
->
pthread_FH
,
attr_FH
,
ru_thread
,
(
void
*
)
ru
);
if
(
emulate_rf
)
pthread_create
(
&
proc
->
pthread_emulateRF
,
attr_emulateRF
,
emulatedRF_thread
,
(
void
*
)
proc
);
if
(
ru
->
function
==
NGFI_RRU_IF4p5
)
{
pthread_create
(
&
proc
->
pthread_prach
,
attr_prach
,
ru_thread_prach
,
(
void
*
)
ru
);
///tmp deactivation of synch thread
...
...
targets/RT/USER/nr-softmodem.c
View file @
2f66c11d
...
...
@@ -208,7 +208,7 @@ extern void init_eNB_afterRU(void);
int
transmission_mode
=
1
;
int
emulate_rf
=
0
;
//
int numerology = 0;
int
numerology
=
0
;
int
codingw
=
0
;
//int fepw = 0;
...
...
targets/RT/USER/nr-softmodem.h
View file @
2f66c11d
...
...
@@ -86,6 +86,8 @@
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n"
/***************************************************************************************************************************************/
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
when calling config_get or config_getlist functions */
...
...
@@ -167,6 +169,7 @@
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT,PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 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