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
263aef27
Commit
263aef27
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
f2ee63e9
ocp_simulator
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
127 deletions
+127
-127
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+1
-1
targets/ARCH/rfsimulator/simulator.c
targets/ARCH/rfsimulator/simulator.c
+115
-105
targets/RT/USER/lte-ue.c
targets/RT/USER/lte-ue.c
+11
-21
No files found.
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
263aef27
...
...
@@ -188,7 +188,7 @@ static int sync_to_gps(openair0_device *device) {
num_gps_locked
++
;
std
::
cout
<<
boost
::
format
(
"GPS Locked
\n
"
);
}
else
{
LOG_W
(
HW
,
"
WARNING: GPS not locked - time will not be accurate until locked
\n
"
)
;
LOG_W
(
HW
,
"
GPS not locked - time will not be accurate until locked"
<<
std
::
endl
;
}
//Set to GPS time
...
...
This diff is collapsed.
Click to expand it.
targets/ARCH/rfsimulator/simulator.c
View file @
263aef27
...
...
@@ -177,7 +177,6 @@ int start_ue(openair0_device *device) {
}
int
tcp_bridge_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
samplesVoid
,
int
nsamps
,
int
nbAnt
,
int
flags
)
{
tcp_bridge_state_t
*
t
=
device
->
priv
;
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
{
...
...
@@ -187,15 +186,17 @@ int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void
setblocking
(
ptr
->
conn_sock
,
blocking
);
transferHeader
header
=
{
t
->
typeStamp
,
nsamps
,
nbAnt
,
timestamp
};
int
n
=-
1
;
AssertFatal
(
fullwrite
(
ptr
->
conn_sock
,
&
header
,
sizeof
(
header
))
==
sizeof
(
header
),
""
);
sample_t
tmpSamples
[
nsamps
][
nbAnt
];
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
in
=
(
sample_t
*
)
samplesVoid
[
a
];
sample_t
*
in
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
s
=
0
;
s
<
nsamps
;
s
++
)
tmpSamples
[
s
][
a
]
=
in
[
s
];
}
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
)
)
{
LOG_E
(
HW
,
"tcp_bridge: write error ret %d (wanted %ld) error %s
\n
"
,
n
,
sampleToByte
(
nsamps
,
nbAnt
),
strerror
(
errno
));
...
...
@@ -215,22 +216,16 @@ int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void
bool
flushInput
(
tcp_bridge_state_t
*
t
)
{
// Process all incoming events on sockets
// store the data in lists
bool
completedABuffer
=
false
;
int
iterations
=
10
;
while
(
!
completedABuffer
&&
iterations
--
)
{
struct
epoll_event
events
[
FD_SETSIZE
]
=
{
0
};
int
nfds
=
epoll_wait
(
t
->
epollfd
,
events
,
FD_SETSIZE
,
2
0
);
int
nfds
=
epoll_wait
(
t
->
epollfd
,
events
,
FD_SETSIZE
,
20
0
);
if
(
nfds
==-
1
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
continu
e
;
return
fals
e
;
else
AssertFatal
(
false
,
"error in epoll_wait
\n
"
);
}
//printf("waited iter=%d, res %d, waiting fd %d\n", iterations, nfds, nfds>=1? events[0].data.fd:-1);
for
(
int
nbEv
=
0
;
nbEv
<
nfds
;
++
nbEv
)
{
int
fd
=
events
[
nbEv
].
data
.
fd
;
...
...
@@ -278,14 +273,26 @@ bool flushInput(tcp_bridge_state_t *t) {
AssertFatal
((
b
->
remainToTransfer
-=
sz
)
>=
0
,
""
);
b
->
transferPtr
+=
sz
;
if
(
b
->
transferPtr
==
b
->
circularBufEnd
-
1
)
b
->
transferPtr
=
(
char
*
)
b
->
circularBuf
;
b
->
transferPtr
=
(
char
*
)
b
->
circularBuf
;
// check the header and start block transfer
if
(
b
->
headerMode
==
true
&&
b
->
remainToTransfer
==
0
)
{
AssertFatal
(
(
t
->
typeStamp
==
MAGICUE
&&
b
->
th
.
magic
==
MAGICeNB
)
||
(
t
->
typeStamp
==
MAGICeNB
&&
b
->
th
.
magic
==
MAGICUE
),
"Socket Error in protocol"
);
b
->
headerMode
=
false
;
if
(
b
->
lastReceivedTS
!=
b
->
th
.
timestamp
)
{
int
nbAnt
=
b
->
th
.
nbAnt
;
for
(
uint64_t
index
=
b
->
lastReceivedTS
;
index
<
b
->
th
.
timestamp
;
index
++
)
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
b
->
circularBuf
[(
index
*
nbAnt
+
a
)
%
CirSize
]
=
0
;
LOG_W
(
HW
,
"gap of: %ld in reception
\n
"
,
b
->
th
.
timestamp
-
b
->
lastReceivedTS
);
}
b
->
lastReceivedTS
=
b
->
th
.
timestamp
;
b
->
transferPtr
=
(
char
*
)
&
b
->
circularBuf
[
b
->
lastReceivedTS
%
CirSize
];
b
->
remainToTransfer
=
sampleToByte
(
b
->
th
.
size
,
b
->
th
.
nbAnt
);
...
...
@@ -293,12 +300,14 @@ bool flushInput(tcp_bridge_state_t *t) {
if
(
b
->
headerMode
==
false
)
{
b
->
lastReceivedTS
=
b
->
th
.
timestamp
+
b
->
th
.
size
-
byteToSample
(
b
->
remainToTransfer
,
b
->
th
.
nbAnt
);
if
(
b
->
remainToTransfer
==
0
)
{
completedABuffer
=
true
;
LOG_D
(
HW
,
"Completed block reception: %ld
\n
"
,
b
->
lastReceivedTS
);
// First block in UE, resync with the eNB current TS
if
(
t
->
nextTimestamp
==
0
)
t
->
nextTimestamp
=
b
->
lastReceivedTS
-
b
->
th
.
size
;
b
->
headerMode
=
true
;
b
->
transferPtr
=
(
char
*
)
&
b
->
th
;
b
->
remainToTransfer
=
sizeof
(
transferHeader
);
...
...
@@ -307,9 +316,8 @@ bool flushInput(tcp_bridge_state_t *t) {
}
}
}
}
return
completedABuffer
;
return
nfds
>
0
;
}
int
tcp_bridge_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
samplesVoid
,
int
nsamps
,
int
nbAnt
)
{
...
...
@@ -317,7 +325,6 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
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
// check if a UE is connected
int
first_sock
;
...
...
@@ -331,10 +338,13 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
if
(
!
flushInput
(
t
))
{
for
(
int
x
=
0
;
x
<
nbAnt
;
x
++
)
memset
(
samplesVoid
[
x
],
0
,
sampleToByte
(
nsamps
,
1
));
t
->
nextTimestamp
+=
nsamps
;
LOG_W
(
HW
,
"Generated void samples for Rx: %ld
\n
"
,
t
->
nextTimestamp
);
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
=
0
;
}
...
...
@@ -368,6 +378,7 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
// Clear the output buffer
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
=
0
;
}
...
...
@@ -379,8 +390,9 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
if
(
ptr
->
circularBuf
&&
ptr
->
alreadyWrote
)
{
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
+=
ptr
->
circularBuf
[(
t
->
nextTimestamp
+
(
a
*
nbAnt
+
i
)
)
%
CirSize
]
<<
1
;
out
[
i
]
+=
ptr
->
circularBuf
[((
t
->
nextTimestamp
+
i
)
*
nbAnt
+
a
)
%
CirSize
]
<<
1
;
}
}
}
...
...
@@ -435,7 +447,6 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
MAGICeNB:
MAGICUE
;
LOG_I
(
HW
,
"tcp_bridge: running as %s
\n
"
,
tcp_bridge
->
typeStamp
==
MAGICeNB
?
"eNB"
:
"UE"
);
device
->
trx_start_func
=
tcp_bridge
->
typeStamp
==
MAGICeNB
?
server_start
:
start_ue
;
...
...
@@ -450,13 +461,12 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
/* let's pretend to be a b2x0 */
device
->
type
=
USRP_B200_DEV
;
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
,
""
);
AssertFatal
((
tcp_bridge
->
epollfd
=
epoll_create1
(
0
))
!=
-
1
,
""
);
tcp_bridge
->
initialAhead
=
openair0_cfg
[
0
].
sample_rate
/
1000
;
// One sub frame
return
0
;
}
This diff is collapsed.
Click to expand it.
targets/RT/USER/lte-ue.c
View file @
263aef27
...
...
@@ -545,7 +545,7 @@ static void *UE_thread_synch(void *arg)
// the thread waits here most of the time
pthread_cond_wait
(
&
UE
->
proc
.
cond_synch
,
&
UE
->
proc
.
mutex_synch
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
LOG_I
(
PHY
,
"Starting a sync process
\n
"
);
switch
(
sync_mode
)
{
case
pss
:
LOG_I
(
PHY
,
"[SCHED][UE] Scanning band %d (%d), freq %u
\n
"
,
bands_to_scan
.
band_info
[
current_band
].
band
,
current_band
,
bands_to_scan
.
band_info
[
current_band
].
dl_min
+
current_offset
);
...
...
@@ -578,11 +578,7 @@ static void *UE_thread_synch(void *arg)
case
pbch
:
#if DISABLE_LOG_X
printf
(
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
#else
LOG_I
(
PHY
,
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
#endif
if
(
initial_sync
(
UE
,
UE
->
mode
)
==
0
)
{
LOG_I
(
HW
,
"Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d
\n
"
,
...
...
@@ -702,19 +698,11 @@ static void *UE_thread_synch(void *arg)
return
&
UE_thread_synch_retval
;
// not reached
}
}
#if DISABLE_LOG_X
printf
(
"[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)
\n
"
,
freq_offset
,
UE
->
rx_total_gain_dB
,
downlink_frequency
[
0
][
0
]
+
freq_offset
,
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
0
][
0
]
+
freq_offset
);
#else
LOG_I
(
PHY
,
"[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)
\n
"
,
freq_offset
,
UE
->
rx_total_gain_dB
,
downlink_frequency
[
0
][
0
]
+
freq_offset
,
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
0
][
0
]
+
freq_offset
);
#endif
for
(
i
=
0
;
i
<
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_num_channels
;
i
++
)
{
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
]
+
freq_offset
;
...
...
@@ -1532,7 +1520,7 @@ void *UE_thread(void *arg) {
PHY_VARS_UE
*
UE
=
(
PHY_VARS_UE
*
)
arg
;
// int tx_enabled = 0;
openair0_timestamp
timestamp
,
timestamp1
;
openair0_timestamp
timestamp
;
void
*
rxp
[
NB_ANTENNAS_RX
],
*
txp
[
NB_ANTENNAS_TX
];
int
start_rx_stream
=
0
;
int
i
;
...
...
@@ -1781,13 +1769,15 @@ void *UE_thread(void *arg) {
if
(
sub_frame
==
9
)
{
// read in first symbol of next frame and adjust for timing drift
int
first_symbols
=
writeBlockSize
-
readBlockSize
;
if
(
first_symbols
>
0
)
if
(
first_symbols
>
0
)
{
openair0_timestamp
timestamp1
;
AssertFatal
(
first_symbols
==
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
&
timestamp1
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
first_symbols
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
}
if
(
first_symbols
<
0
)
LOG_E
(
PHY
,
"can't compensate: diff =%d
\n
"
,
first_symbols
);
}
...
...
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