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
promise
OpenXG-RAN
Commits
f2ee63e9
Commit
f2ee63e9
authored
6 years ago
by
laurent
Committed by
frtabu
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests in tdd, still sync failures (random cases)
parent
eea3a432
ocp_simulator
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
43 deletions
+28
-43
targets/ARCH/rfsimulator/simulator.c
targets/ARCH/rfsimulator/simulator.c
+23
-38
targets/RT/USER/lte-ue.c
targets/RT/USER/lte-ue.c
+5
-5
No files found.
targets/ARCH/rfsimulator/simulator.c
View file @
f2ee63e9
...
@@ -49,6 +49,7 @@ typedef struct {
...
@@ -49,6 +49,7 @@ typedef struct {
int
listen_sock
,
epollfd
;
int
listen_sock
,
epollfd
;
uint64_t
nextTimestamp
;
uint64_t
nextTimestamp
;
uint64_t
typeStamp
;
uint64_t
typeStamp
;
uint64_t
initialAhead
;
char
*
ip
;
char
*
ip
;
buffer_t
buf
[
FD_SETSIZE
];
buffer_t
buf
[
FD_SETSIZE
];
}
tcp_bridge_state_t
;
}
tcp_bridge_state_t
;
...
@@ -124,25 +125,8 @@ void setblocking(int sock, enum blocking_t active) {
...
@@ -124,25 +125,8 @@ void setblocking(int sock, enum blocking_t active) {
AssertFatal
(
fcntl
(
sock
,
F_SETFL
,
opts
)
>=
0
,
""
);
AssertFatal
(
fcntl
(
sock
,
F_SETFL
,
opts
)
>=
0
,
""
);
}
}
tcp_bridge_state_t
*
init_bridge
(
openair0_device
*
device
)
{
tcp_bridge_state_t
*
tcp_bridge
;
if
(
device
->
priv
)
tcp_bridge
=
(
tcp_bridge_state_t
*
)
device
->
priv
;
else
AssertFatal
(((
tcp_bridge
=
(
tcp_bridge_state_t
*
)
calloc
(
sizeof
(
tcp_bridge_state_t
),
1
)))
!=
NULL
,
""
);
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
tcp_bridge
->
buf
[
i
].
conn_sock
=-
1
;
device
->
priv
=
tcp_bridge
;
AssertFatal
((
tcp_bridge
->
epollfd
=
epoll_create1
(
0
))
!=
-
1
,
""
);
return
tcp_bridge
;
}
int
server_start
(
openair0_device
*
device
)
{
int
server_start
(
openair0_device
*
device
)
{
tcp_bridge_state_t
*
t
=
init_bridge
(
device
)
;
tcp_bridge_state_t
*
t
=
(
tcp_bridge_state_t
*
)
device
->
priv
;
t
->
typeStamp
=
MAGICeNB
;
t
->
typeStamp
=
MAGICeNB
;
AssertFatal
((
t
->
listen_sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
>=
0
,
""
);
AssertFatal
((
t
->
listen_sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
>=
0
,
""
);
int
enable
=
1
;
int
enable
=
1
;
...
@@ -162,7 +146,7 @@ int server_start(openair0_device *device) {
...
@@ -162,7 +146,7 @@ int server_start(openair0_device *device) {
}
}
int
start_ue
(
openair0_device
*
device
)
{
int
start_ue
(
openair0_device
*
device
)
{
tcp_bridge_state_t
*
t
=
init_bridge
(
device
)
;
tcp_bridge_state_t
*
t
=
device
->
priv
;
t
->
typeStamp
=
MAGICUE
;
t
->
typeStamp
=
MAGICUE
;
int
sock
;
int
sock
;
AssertFatal
((
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
>=
0
,
""
);
AssertFatal
((
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
>=
0
,
""
);
...
@@ -175,10 +159,10 @@ int start_ue(openair0_device *device) {
...
@@ -175,10 +159,10 @@ int start_ue(openair0_device *device) {
bool
connected
=
false
;
bool
connected
=
false
;
while
(
!
connected
)
{
while
(
!
connected
)
{
printf
(
"tcp_bridge: trying to connect to %s:%d
\n
"
,
t
->
ip
,
PORT
);
LOG_I
(
HW
,
"tcp_bridge: trying to connect to %s:%d
\n
"
,
t
->
ip
,
PORT
);
if
(
connect
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
==
0
)
{
if
(
connect
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
==
0
)
{
printf
(
"tcp_bridge: connection established
\n
"
);
LOG_I
(
HW
,
"tcp_bridge: connection established
\n
"
);
connected
=
true
;
connected
=
true
;
}
}
...
@@ -188,7 +172,7 @@ int start_ue(openair0_device *device) {
...
@@ -188,7 +172,7 @@ int start_ue(openair0_device *device) {
setblocking
(
sock
,
notBlocking
);
setblocking
(
sock
,
notBlocking
);
allocCirBuf
(
t
,
sock
);
allocCirBuf
(
t
,
sock
);
t
->
buf
[
sock
].
alreadyWrote
=
true
;
t
->
buf
[
sock
].
alreadyWrote
=
true
;
//+=t->initialAhead; // UE is slave
return
0
;
return
0
;
}
}
...
@@ -214,11 +198,11 @@ int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void
...
@@ -214,11 +198,11 @@ int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void
n
=
fullwrite
(
ptr
->
conn_sock
,
(
void
*
)
tmpSamples
,
sampleToByte
(
nsamps
,
nbAnt
));
n
=
fullwrite
(
ptr
->
conn_sock
,
(
void
*
)
tmpSamples
,
sampleToByte
(
nsamps
,
nbAnt
));
if
(
n
!=
sampleToByte
(
nsamps
,
nbAnt
)
)
{
if
(
n
!=
sampleToByte
(
nsamps
,
nbAnt
)
)
{
printf
(
"tcp_bridge: write error ret %d (wanted %ld) error %s
\n
"
,
n
,
sampleToByte
(
nsamps
,
nbAnt
),
strerror
(
errno
));
LOG_E
(
HW
,
"tcp_bridge: write error ret %d (wanted %ld) error %s
\n
"
,
n
,
sampleToByte
(
nsamps
,
nbAnt
),
strerror
(
errno
));
abort
();
abort
();
}
}
ptr
->
alreadyWrote
=
true
;
ptr
->
alreadyWrote
=
true
;
//+=nsamps;
setblocking
(
ptr
->
conn_sock
,
notBlocking
);
setblocking
(
ptr
->
conn_sock
,
notBlocking
);
}
}
}
}
...
@@ -329,9 +313,11 @@ bool flushInput(tcp_bridge_state_t *t) {
...
@@ -329,9 +313,11 @@ bool flushInput(tcp_bridge_state_t *t) {
}
}
int
tcp_bridge_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
samplesVoid
,
int
nsamps
,
int
nbAnt
)
{
int
tcp_bridge_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
samplesVoid
,
int
nsamps
,
int
nbAnt
)
{
if
(
nbAnt
!=
1
)
{
printf
(
"tcp_bridge: only 1 antenna tested
\n
"
);
exit
(
1
);
}
if
(
nbAnt
!=
1
)
{
LOG_E
(
HW
,
"tcp_bridge: only 1 antenna tested
\n
"
);
exit
(
1
);
}
tcp_bridge_state_t
*
t
=
device
->
priv
;
tcp_bridge_state_t
*
t
=
device
->
priv
;
LOG_D
(
HW
,
"Enter tcp_bridge_read, expect %d samples, will release at TS: %ld
\n
"
,
nsamps
,
t
->
nextTimestamp
+
nsamps
);
// deliver data from received data
// deliver data from received data
// check if a UE is connected
// check if a UE is connected
int
first_sock
;
int
first_sock
;
...
@@ -364,7 +350,7 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
...
@@ -364,7 +350,7 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
for
(
int
sock
=
0
;
sock
<
FD_SETSIZE
;
sock
++
)
for
(
int
sock
=
0
;
sock
<
FD_SETSIZE
;
sock
++
)
if
(
t
->
buf
[
sock
].
circularBuf
&&
if
(
t
->
buf
[
sock
].
circularBuf
&&
t
->
buf
[
sock
].
alreadyWrote
&&
t
->
buf
[
sock
].
alreadyWrote
&&
//>= t->initialAhead &&
(
t
->
nextTimestamp
+
nsamps
)
>
t
->
buf
[
sock
].
lastReceivedTS
)
{
(
t
->
nextTimestamp
+
nsamps
)
>
t
->
buf
[
sock
].
lastReceivedTS
)
{
have_to_wait
=
true
;
have_to_wait
=
true
;
break
;
break
;
...
@@ -441,22 +427,14 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
...
@@ -441,22 +427,14 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
tcp_bridge_state_t
*
tcp_bridge
=
(
tcp_bridge_state_t
*
)
calloc
(
sizeof
(
tcp_bridge_state_t
),
1
);
tcp_bridge_state_t
*
tcp_bridge
=
(
tcp_bridge_state_t
*
)
calloc
(
sizeof
(
tcp_bridge_state_t
),
1
);
if
((
tcp_bridge
->
ip
=
getenv
(
"RFSIMULATOR"
))
==
NULL
)
{
if
((
tcp_bridge
->
ip
=
getenv
(
"RFSIMULATOR"
))
==
NULL
)
{
printf
(
helpTxt
);
LOG_E
(
HW
,
helpTxt
);
exit
(
1
);
exit
(
1
);
}
}
tcp_bridge
->
typeStamp
=
strncasecmp
(
tcp_bridge
->
ip
,
"enb"
,
3
)
==
0
?
tcp_bridge
->
typeStamp
=
strncasecmp
(
tcp_bridge
->
ip
,
"enb"
,
3
)
==
0
?
MAGICeNB:
MAGICeNB:
MAGICUE
;
MAGICUE
;
printf
(
"tcp_bridge: running as %s
\n
"
,
tcp_bridge
->
typeStamp
==
MAGICeNB
?
"eNB"
:
"UE"
);
LOG_I
(
HW
,
"tcp_bridge: running as %s
\n
"
,
tcp_bridge
->
typeStamp
==
MAGICeNB
?
"eNB"
:
"UE"
);
/* only 25, 50 or 100 PRBs handled for the moment */
if
(
openair0_cfg
[
0
].
sample_rate
!=
30720000
&&
openair0_cfg
[
0
].
sample_rate
!=
15360000
&&
openair0_cfg
[
0
].
sample_rate
!=
7680000
)
{
printf
(
"tcp_bridge: ERROR: only 25, 50 or 100 PRBs supported
\n
"
);
exit
(
1
);
}
device
->
trx_start_func
=
tcp_bridge
->
typeStamp
==
MAGICeNB
?
device
->
trx_start_func
=
tcp_bridge
->
typeStamp
==
MAGICeNB
?
server_start
:
server_start
:
...
@@ -469,9 +447,16 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
...
@@ -469,9 +447,16 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device
->
trx_set_gains_func
=
tcp_bridge_set_gains
;
device
->
trx_set_gains_func
=
tcp_bridge_set_gains
;
device
->
trx_write_func
=
tcp_bridge_write
;
device
->
trx_write_func
=
tcp_bridge_write
;
device
->
trx_read_func
=
tcp_bridge_read
;
device
->
trx_read_func
=
tcp_bridge_read
;
device
->
priv
=
tcp_bridge
;
/* let's pretend to be a b2x0 */
/* let's pretend to be a b2x0 */
device
->
type
=
USRP_B200_DEV
;
device
->
type
=
USRP_B200_DEV
;
device
->
openair0_cfg
=&
openair0_cfg
[
0
];
device
->
openair0_cfg
=&
openair0_cfg
[
0
];
device
->
priv
=
tcp_bridge
;
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
tcp_bridge
->
buf
[
i
].
conn_sock
=-
1
;
AssertFatal
((
tcp_bridge
->
epollfd
=
epoll_create1
(
0
))
!=
-
1
,
""
);
tcp_bridge
->
initialAhead
=
openair0_cfg
[
0
].
sample_rate
/
1000
;
// One sub frame
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
targets/RT/USER/lte-ue.c
View file @
f2ee63e9
...
@@ -640,7 +640,7 @@ static void *UE_thread_synch(void *arg)
...
@@ -640,7 +640,7 @@ static void *UE_thread_synch(void *arg)
UE
->
rfdevice
.
trx_set_freq_func
(
&
UE
->
rfdevice
,
&
openair0_cfg
[
0
],
0
);
UE
->
rfdevice
.
trx_set_freq_func
(
&
UE
->
rfdevice
,
&
openair0_cfg
[
0
],
0
);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
sleep
(
1
);
usleep
(
10000
);
init_frame_parms
(
&
UE
->
frame_parms
,
1
);
init_frame_parms
(
&
UE
->
frame_parms
,
1
);
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
LOG_E(HW,"Could not start the device\n");
LOG_E(HW,"Could not start the device\n");
...
@@ -1576,10 +1576,10 @@ void *UE_thread(void *arg) {
...
@@ -1576,10 +1576,10 @@ void *UE_thread(void *arg) {
}
}
#endif
#endif
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
int
instance_cnt_synch
=
UE
->
proc
.
instance_cnt_synch
;
int
instance_cnt_synch
=
UE
->
proc
.
instance_cnt_synch
;
int
is_synchronized
=
UE
->
is_synchronized
;
int
is_synchronized
=
UE
->
is_synchronized
;
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
if
(
is_synchronized
==
0
)
{
if
(
is_synchronized
==
0
)
{
if
(
instance_cnt_synch
<
0
)
{
// we can invoke the synch
if
(
instance_cnt_synch
<
0
)
{
// we can invoke the synch
...
@@ -1609,10 +1609,10 @@ void *UE_thread(void *arg) {
...
@@ -1609,10 +1609,10 @@ void *UE_thread(void *arg) {
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_tx
;
i
++
)
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_tx
;
i
++
)
free
(
dummy_tx
[
i
]);
free
(
dummy_tx
[
i
]);
}
}
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
++
UE
->
proc
.
instance_cnt_synch
,
"[SCHED][UE] UE sync thread busy!!
\n
"
);
AssertFatal
(
0
==
++
UE
->
proc
.
instance_cnt_synch
,
"[SCHED][UE] UE sync thread busy!!
\n
"
);
AssertFatal
(
0
==
pthread_cond_signal
(
&
UE
->
proc
.
cond_synch
),
""
);
AssertFatal
(
0
==
pthread_cond_signal
(
&
UE
->
proc
.
cond_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
}
else
{
}
else
{
// grab 10 ms of signal into dummy buffer to wait result of sync detection
// grab 10 ms of signal into dummy buffer to wait result of sync detection
if
(
UE
->
mode
!=
loop_through_memory
)
{
if
(
UE
->
mode
!=
loop_through_memory
)
{
...
...
This diff is collapsed.
Click to expand it.
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