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
wangwenhui
OpenXG-RAN
Commits
263aef27
Commit
263aef27
authored
Jan 23, 2019
by
laurent
Committed by
frtabu
Feb 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests in tdd, still sync failures (random cases)
parent
f2ee63e9
Changes
3
Hide 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) {
...
@@ -188,7 +188,7 @@ static int sync_to_gps(openair0_device *device) {
num_gps_locked
++
;
num_gps_locked
++
;
std
::
cout
<<
boost
::
format
(
"GPS Locked
\n
"
);
std
::
cout
<<
boost
::
format
(
"GPS Locked
\n
"
);
}
else
{
}
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
//Set to GPS time
...
...
targets/ARCH/rfsimulator/simulator.c
View file @
263aef27
...
@@ -177,9 +177,8 @@ int start_ue(openair0_device *device) {
...
@@ -177,9 +177,8 @@ int start_ue(openair0_device *device) {
}
}
int
tcp_bridge_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
samplesVoid
,
int
nsamps
,
int
nbAnt
,
int
flags
)
{
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
;
tcp_bridge_state_t
*
t
=
device
->
priv
;
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
{
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
{
buffer_t
*
ptr
=&
t
->
buf
[
i
];
buffer_t
*
ptr
=&
t
->
buf
[
i
];
...
@@ -187,15 +186,17 @@ int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void
...
@@ -187,15 +186,17 @@ int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void
setblocking
(
ptr
->
conn_sock
,
blocking
);
setblocking
(
ptr
->
conn_sock
,
blocking
);
transferHeader
header
=
{
t
->
typeStamp
,
nsamps
,
nbAnt
,
timestamp
};
transferHeader
header
=
{
t
->
typeStamp
,
nsamps
,
nbAnt
,
timestamp
};
int
n
=-
1
;
int
n
=-
1
;
AssertFatal
(
fullwrite
(
ptr
->
conn_sock
,
&
header
,
sizeof
(
header
))
==
sizeof
(
header
),
""
);
AssertFatal
(
fullwrite
(
ptr
->
conn_sock
,
&
header
,
sizeof
(
header
))
==
sizeof
(
header
),
""
);
sample_t
tmpSamples
[
nsamps
][
nbAnt
];
sample_t
tmpSamples
[
nsamps
][
nbAnt
];
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
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
];
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
)
)
{
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
));
LOG_E
(
HW
,
"tcp_bridge: write error ret %d (wanted %ld) error %s
\n
"
,
n
,
sampleToByte
(
nsamps
,
nbAnt
),
strerror
(
errno
));
...
@@ -215,101 +216,108 @@ int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void
...
@@ -215,101 +216,108 @@ int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void
bool
flushInput
(
tcp_bridge_state_t
*
t
)
{
bool
flushInput
(
tcp_bridge_state_t
*
t
)
{
// Process all incoming events on sockets
// Process all incoming events on sockets
// store the data in lists
// store the data in lists
bool
completedABuffer
=
false
;
struct
epoll_event
events
[
FD_SETSIZE
]
=
{
0
};
int
iterations
=
10
;
int
nfds
=
epoll_wait
(
t
->
epollfd
,
events
,
FD_SETSIZE
,
200
);
if
(
nfds
==-
1
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
return
false
;
else
AssertFatal
(
false
,
"error in epoll_wait
\n
"
);
}
for
(
int
nbEv
=
0
;
nbEv
<
nfds
;
++
nbEv
)
{
int
fd
=
events
[
nbEv
].
data
.
fd
;
if
(
events
[
nbEv
].
events
&
EPOLLIN
&&
fd
==
t
->
listen_sock
)
{
int
conn_sock
;
AssertFatal
(
(
conn_sock
=
accept
(
t
->
listen_sock
,
NULL
,
NULL
))
!=
-
1
,
""
);
allocCirBuf
(
t
,
conn_sock
);
LOG_I
(
HW
,
"A ue connected
\n
"
);
}
else
{
if
(
events
[
nbEv
].
events
&
(
EPOLLHUP
|
EPOLLERR
|
EPOLLRDHUP
)
)
{
LOG_W
(
HW
,
"Lost socket
\n
"
);
removeCirBuf
(
t
,
fd
);
while
(
!
completedABuffer
&&
iterations
--
)
{
if
(
t
->
typeStamp
==
MAGICUE
)
struct
epoll_event
events
[
FD_SETSIZE
]
=
{
0
};
exit
(
1
);
int
nfds
=
epoll_wait
(
t
->
epollfd
,
events
,
FD_SETSIZE
,
20
);
if
(
nfds
==-
1
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
continue
;
continue
;
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)
;
buffer_t
*
b
=&
t
->
buf
[
fd
]
;
for
(
int
nbEv
=
0
;
nbEv
<
nfds
;
++
nbEv
)
{
if
(
b
->
circularBuf
==
NULL
)
{
int
fd
=
events
[
nbEv
].
data
.
fd
;
LOG_E
(
HW
,
"received data on not connected socket %d
\n
"
,
events
[
nbEv
].
data
.
fd
);
continue
;
}
if
(
events
[
nbEv
].
events
&
EPOLLIN
&&
fd
==
t
->
listen_sock
)
{
int
blockSz
;
int
conn_sock
;
AssertFatal
(
(
conn_sock
=
accept
(
t
->
listen_sock
,
NULL
,
NULL
))
!=
-
1
,
""
);
if
(
b
->
headerMode
)
allocCirBuf
(
t
,
conn_sock
);
blockSz
=
b
->
remainToTransfer
;
LOG_I
(
HW
,
"A ue connected
\n
"
);
else
}
else
{
blockSz
=
b
->
transferPtr
+
b
->
remainToTransfer
<
b
->
circularBufEnd
?
if
(
events
[
nbEv
].
events
&
(
EPOLLHUP
|
EPOLLERR
|
EPOLLRDHUP
)
)
{
b
->
remainToTransfer
:
LOG_W
(
HW
,
"Lost socket
\n
"
);
b
->
circularBufEnd
-
1
-
b
->
transferPtr
;
removeCirBuf
(
t
,
fd
);
if
(
t
->
typeStamp
==
MAGICUE
)
int
sz
=
recv
(
fd
,
b
->
transferPtr
,
blockSz
,
MSG_DONTWAIT
);
exit
(
1
);
continue
;
if
(
sz
<
0
)
{
if
(
errno
!=
EAGAIN
)
{
LOG_E
(
HW
,
"socket failed %s
\n
"
,
strerror
(
errno
));
abort
();
}
}
}
else
if
(
sz
==
0
)
continue
;
buffer_t
*
b
=&
t
->
buf
[
fd
];
AssertFatal
((
b
->
remainToTransfer
-=
sz
)
>=
0
,
""
);
b
->
transferPtr
+=
sz
;
if
(
b
->
circularBuf
==
NULL
)
{
if
(
b
->
transferPtr
==
b
->
circularBufEnd
-
1
)
LOG_E
(
HW
,
"received data on not connected socket %d
\n
"
,
events
[
nbEv
].
data
.
fd
);
b
->
transferPtr
=
(
char
*
)
b
->
circularBuf
;
continue
;
}
// 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
;
int
blockSz
;
for
(
uint64_t
index
=
b
->
lastReceivedTS
;
index
<
b
->
th
.
timestamp
;
index
++
)
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
if
(
b
->
headerMode
)
b
->
circularBuf
[(
index
*
nbAnt
+
a
)
%
CirSize
]
=
0
;
blockSz
=
b
->
remainToTransfer
;
else
LOG_W
(
HW
,
"gap of: %ld in reception
\n
"
,
b
->
th
.
timestamp
-
b
->
lastReceivedTS
);
blockSz
=
b
->
transferPtr
+
b
->
remainToTransfer
<
b
->
circularBufEnd
?
b
->
remainToTransfer
:
b
->
circularBufEnd
-
1
-
b
->
transferPtr
;
int
sz
=
recv
(
fd
,
b
->
transferPtr
,
blockSz
,
MSG_DONTWAIT
);
if
(
sz
<
0
)
{
if
(
errno
!=
EAGAIN
)
{
LOG_E
(
HW
,
"socket failed %s
\n
"
,
strerror
(
errno
));
abort
();
}
}
else
if
(
sz
==
0
)
continue
;
AssertFatal
((
b
->
remainToTransfer
-=
sz
)
>=
0
,
""
);
b
->
transferPtr
+=
sz
;
if
(
b
->
transferPtr
==
b
->
circularBufEnd
-
1
)
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
;
b
->
lastReceivedTS
=
b
->
th
.
timestamp
;
b
->
transferPtr
=
(
char
*
)
&
b
->
circularBuf
[
b
->
lastReceivedTS
%
CirSize
];
b
->
remainToTransfer
=
sampleToByte
(
b
->
th
.
size
,
b
->
th
.
nbAnt
);
}
}
if
(
b
->
headerMode
==
false
)
{
b
->
lastReceivedTS
=
b
->
th
.
timestamp
;
b
->
lastReceivedTS
=
b
->
th
.
timestamp
+
b
->
th
.
size
-
byteToSample
(
b
->
remainToTransfer
,
b
->
th
.
nbAnt
);
b
->
transferPtr
=
(
char
*
)
&
b
->
circularBuf
[
b
->
lastReceivedTS
%
CirSize
];
if
(
b
->
remainToTransfer
==
0
)
{
b
->
remainToTransfer
=
sampleToByte
(
b
->
th
.
size
,
b
->
th
.
nbAnt
);
completedABuffer
=
true
;
}
LOG_D
(
HW
,
"Completed block reception: %ld
\n
"
,
b
->
lastReceivedTS
);
// First block in UE, resync with the eNB current TS
if
(
b
->
headerMode
==
false
)
{
if
(
t
->
nextTimestamp
==
0
)
b
->
lastReceivedTS
=
b
->
th
.
timestamp
+
b
->
th
.
size
-
byteToSample
(
b
->
remainToTransfer
,
b
->
th
.
nbAnt
);
t
->
nextTimestamp
=
b
->
lastReceivedTS
-
b
->
th
.
size
;
b
->
headerMode
=
true
;
if
(
b
->
remainToTransfer
==
0
)
{
b
->
transferPtr
=
(
char
*
)
&
b
->
th
;
LOG_D
(
HW
,
"Completed block reception: %ld
\n
"
,
b
->
lastReceivedTS
);
b
->
remainToTransfer
=
sizeof
(
transferHeader
);
b
->
th
.
magic
=-
1
;
// 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
);
b
->
th
.
magic
=-
1
;
}
}
}
}
}
}
}
}
return
completedABuffer
;
return
nfds
>
0
;
}
}
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
)
{
...
@@ -317,7 +325,6 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
...
@@ -317,7 +325,6 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
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
);
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
;
...
@@ -329,14 +336,17 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
...
@@ -329,14 +336,17 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
if
(
first_sock
==
FD_SETSIZE
)
{
if
(
first_sock
==
FD_SETSIZE
)
{
// no connected device (we are eNB, no UE is connected)
// no connected device (we are eNB, no UE is connected)
if
(
!
flushInput
(
t
))
{
if
(
!
flushInput
(
t
))
{
for
(
int
x
=
0
;
x
<
nbAnt
;
x
++
)
for
(
int
x
=
0
;
x
<
nbAnt
;
x
++
)
memset
(
samplesVoid
[
x
],
0
,
sampleToByte
(
nsamps
,
1
));
memset
(
samplesVoid
[
x
],
0
,
sampleToByte
(
nsamps
,
1
));
t
->
nextTimestamp
+=
nsamps
;
t
->
nextTimestamp
+=
nsamps
;
LOG_W
(
HW
,
"Generated void samples for Rx: %ld
\n
"
,
t
->
nextTimestamp
);
LOG_W
(
HW
,
"Generated void samples for Rx: %ld
\n
"
,
t
->
nextTimestamp
);
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
=
0
;
}
}
*
ptimestamp
=
t
->
nextTimestamp
-
nsamps
;
*
ptimestamp
=
t
->
nextTimestamp
-
nsamps
;
...
@@ -368,6 +378,7 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
...
@@ -368,6 +378,7 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
// Clear the output buffer
// Clear the output buffer
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
=
0
;
out
[
i
]
=
0
;
}
}
...
@@ -378,9 +389,10 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
...
@@ -378,9 +389,10 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
if
(
ptr
->
circularBuf
&&
ptr
->
alreadyWrote
)
{
if
(
ptr
->
circularBuf
&&
ptr
->
alreadyWrote
)
{
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
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
;
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
+=
ptr
->
circularBuf
[((
t
->
nextTimestamp
+
i
)
*
nbAnt
+
a
)
%
CirSize
]
<<
1
;
}
}
}
}
}
}
...
@@ -388,9 +400,9 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
...
@@ -388,9 +400,9 @@ int tcp_bridge_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
*
ptimestamp
=
t
->
nextTimestamp
;
// return the time of the first sample
*
ptimestamp
=
t
->
nextTimestamp
;
// return the time of the first sample
t
->
nextTimestamp
+=
nsamps
;
t
->
nextTimestamp
+=
nsamps
;
LOG_D
(
HW
,
"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d
\n
"
,
LOG_D
(
HW
,
"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d
\n
"
,
nsamps
,
nsamps
,
*
ptimestamp
,
t
->
nextTimestamp
,
*
ptimestamp
,
t
->
nextTimestamp
,
signal_energy
(
samplesVoid
[
0
],
nsamps
));
signal_energy
(
samplesVoid
[
0
],
nsamps
));
return
nsamps
;
return
nsamps
;
}
}
...
@@ -432,13 +444,12 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
...
@@ -432,13 +444,12 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
}
}
tcp_bridge
->
typeStamp
=
strncasecmp
(
tcp_bridge
->
ip
,
"enb"
,
3
)
==
0
?
tcp_bridge
->
typeStamp
=
strncasecmp
(
tcp_bridge
->
ip
,
"enb"
,
3
)
==
0
?
MAGICeNB:
MAGICeNB:
MAGICUE
;
MAGICUE
;
LOG_I
(
HW
,
"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"
);
device
->
trx_start_func
=
tcp_bridge
->
typeStamp
==
MAGICeNB
?
device
->
trx_start_func
=
tcp_bridge
->
typeStamp
==
MAGICeNB
?
server_start
:
server_start
:
start_ue
;
start_ue
;
device
->
trx_get_stats_func
=
tcp_bridge_get_stats
;
device
->
trx_get_stats_func
=
tcp_bridge_get_stats
;
device
->
trx_reset_stats_func
=
tcp_bridge_reset_stats
;
device
->
trx_reset_stats_func
=
tcp_bridge_reset_stats
;
device
->
trx_end_func
=
tcp_bridge_end
;
device
->
trx_end_func
=
tcp_bridge_end
;
...
@@ -447,16 +458,15 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
...
@@ -447,16 +458,15 @@ 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
;
/* 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
;
device
->
priv
=
tcp_bridge
;
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
tcp_bridge
->
buf
[
i
].
conn_sock
=-
1
;
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
tcp_bridge
->
initialAhead
=
openair0_cfg
[
0
].
sample_rate
/
1000
;
// One sub frame
return
0
;
return
0
;
}
}
targets/RT/USER/lte-ue.c
View file @
263aef27
...
@@ -545,7 +545,7 @@ static void *UE_thread_synch(void *arg)
...
@@ -545,7 +545,7 @@ static void *UE_thread_synch(void *arg)
// the thread waits here most of the time
// the thread waits here most of the time
pthread_cond_wait
(
&
UE
->
proc
.
cond_synch
,
&
UE
->
proc
.
mutex_synch
);
pthread_cond_wait
(
&
UE
->
proc
.
cond_synch
,
&
UE
->
proc
.
mutex_synch
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
LOG_I
(
PHY
,
"Starting a sync process
\n
"
);
switch
(
sync_mode
)
{
switch
(
sync_mode
)
{
case
pss
:
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
);
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)
...
@@ -578,11 +578,7 @@ static void *UE_thread_synch(void *arg)
case
pbch
:
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
);
LOG_I
(
PHY
,
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
#endif
if
(
initial_sync
(
UE
,
UE
->
mode
)
==
0
)
{
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
"
,
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)
...
@@ -702,19 +698,11 @@ static void *UE_thread_synch(void *arg)
return
&
UE_thread_synch_retval
;
// not reached
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
"
,
LOG_I
(
PHY
,
"[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)
\n
"
,
freq_offset
,
freq_offset
,
UE
->
rx_total_gain_dB
,
UE
->
rx_total_gain_dB
,
downlink_frequency
[
0
][
0
]
+
freq_offset
,
downlink_frequency
[
0
][
0
]
+
freq_offset
,
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
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
++
)
{
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
;
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) {
...
@@ -1532,7 +1520,7 @@ void *UE_thread(void *arg) {
PHY_VARS_UE
*
UE
=
(
PHY_VARS_UE
*
)
arg
;
PHY_VARS_UE
*
UE
=
(
PHY_VARS_UE
*
)
arg
;
// int tx_enabled = 0;
// int tx_enabled = 0;
openair0_timestamp
timestamp
,
timestamp1
;
openair0_timestamp
timestamp
;
void
*
rxp
[
NB_ANTENNAS_RX
],
*
txp
[
NB_ANTENNAS_TX
];
void
*
rxp
[
NB_ANTENNAS_RX
],
*
txp
[
NB_ANTENNAS_TX
];
int
start_rx_stream
=
0
;
int
start_rx_stream
=
0
;
int
i
;
int
i
;
...
@@ -1781,13 +1769,15 @@ void *UE_thread(void *arg) {
...
@@ -1781,13 +1769,15 @@ void *UE_thread(void *arg) {
if
(
sub_frame
==
9
)
{
if
(
sub_frame
==
9
)
{
// read in first symbol of next frame and adjust for timing drift
// read in first symbol of next frame and adjust for timing drift
int
first_symbols
=
writeBlockSize
-
readBlockSize
;
int
first_symbols
=
writeBlockSize
-
readBlockSize
;
if
(
first_symbols
>
0
)
if
(
first_symbols
>
0
)
{
AssertFatal
(
first_symbols
==
openair0_timestamp
timestamp1
;
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
AssertFatal
(
first_symbols
==
&
timestamp1
,
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
&
timestamp1
,
first_symbols
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
first_symbols
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
}
if
(
first_symbols
<
0
)
if
(
first_symbols
<
0
)
LOG_E
(
PHY
,
"can't compensate: diff =%d
\n
"
,
first_symbols
);
LOG_E
(
PHY
,
"can't compensate: diff =%d
\n
"
,
first_symbols
);
}
}
...
...
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