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
b9ba3d80
Commit
b9ba3d80
authored
Oct 27, 2014
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@5941
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
a8ec323b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
targets/RT/USER/rrh.c
targets/RT/USER/rrh.c
+17
-13
No files found.
targets/RT/USER/rrh.c
View file @
b9ba3d80
...
...
@@ -72,12 +72,13 @@ void *rrh_eNB_thread(void *arg) {
int16_t
cmd
,
nsamps
,
antenna_index
;
ssize_t
bytes_received
;
openair0_timestamp
timestamp_tx
,
timestamp_rx
=
0
;
int
local_host
=
0
;
ssize_t
bytes_sent
;
while
(
rrh_exit
==
0
)
{
sockid
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
);
sockid
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
if
(
sockid
==-
1
)
{
perror
(
"Cannot create socket: "
);
rrh_exit
=
1
;
...
...
@@ -87,7 +88,7 @@ void *rrh_eNB_thread(void *arg) {
bzero
((
char
*
)
&
serveraddr
,
sizeof
(
serveraddr
));
serveraddr
.
sin_family
=
AF_INET
;
serveraddr
.
sin_port
=
htons
(
rrh_desc
->
port
);
inet_pton
(
AF_INET
,
"
127.0.0.1
"
,
&
serveraddr
.
sin_addr
.
s_addr
);
inet_pton
(
AF_INET
,
"
0.0.0.0
"
,
&
serveraddr
.
sin_addr
.
s_addr
);
inet_ntop
(
AF_INET
,
&
(
serveraddr
.
sin_addr
),
str
,
INET_ADDRSTRLEN
);
printf
(
"Binding to socket for %s:%d
\n
"
,
str
,
ntohs
(
serveraddr
.
sin_port
));
...
...
@@ -101,6 +102,9 @@ void *rrh_eNB_thread(void *arg) {
while
(
rrh_exit
==
0
)
{
// get header info
bzero
((
void
*
)
&
clientaddr
,
sizeof
(
struct
sockaddr
));
clientaddrlen
=
sizeof
(
struct
sockaddr
);
bytes_received
=
recvfrom
(
sockid
,
msg_header
,
4
+
sizeof
(
openair0_timestamp
),
0
,
&
clientaddr
,
&
clientaddrlen
);
cmd
=
msg_header
[
0
];
antenna_index
=
cmd
>>
1
;
...
...
@@ -108,22 +112,21 @@ void *rrh_eNB_thread(void *arg) {
nsamps
=
*
(
int16_t
*
)(
msg_header
+
2
);
cmd
=
cmd
&
1
;
inet_ntop
(
AF_INET
,
&
(((
struct
sockaddr_in
*
)
&
clientaddr
)
->
sin_addr
),
str
,
INET_ADDRSTRLEN
);
if
((((
struct
sockaddr_in
*
)
&
clientaddr
)
->
sin_addr
.
s_addr
)
==
0
)
local_host
=
1
;
else
local_host
=
0
;
switch
(
cmd
)
{
case
0
:
// RX
printf
(
"Received RX request for antenna %d, nsamps %d (from %s:%d)
\n
"
,
antenna_index
,
nsamps
,
str
,
ntohs
(((
struct
sockaddr_in
*
)
&
clientaddr
)
->
sin_port
),
INET_ADDRSTRLEN
);
//
printf("Received RX request for antenna %d, nsamps %d (from %s:%d)\n",antenna_index,nsamps,str,
// ntohs(((struct sockaddr_in*)&clientaddr)->sin_port)
);
// send return
if
(
sendto
(
sockid
,
&
rx_buffer
[
antenna_index
][
timestamp_rx
%
(
76800
*
4
)],
(
nsamps
<<
2
)
+
sizeof
(
openair0_timestamp
),
MSG_DONTWAIT
,
(
local_host
==
0
)
?
&
clientaddr
:
(
struct
sockaddr
*
)
&
server
addr
,
sizeof
(
struct
sockaddr
))
<
0
)
if
(
(
bytes_sent
=
sendto
(
sockid
,
&
rx_buffer
[
antenna_index
][
timestamp_rx
%
(
76800
*
4
)],
(
nsamps
<<
2
)
+
sizeof
(
openair0_timestamp
),
0
,
(
struct
sockaddr
*
)
&
client
addr
,
sizeof
(
struct
sockaddr
)
))
<
0
)
perror
(
"RRH: sendto for RX"
);
// printf("bytes_sent %d(timestamp_rx %d)\n",bytes_sent);
timestamp_rx
+=
nsamps
;
break
;
case
1
:
// TX
...
...
@@ -132,6 +135,7 @@ void *rrh_eNB_thread(void *arg) {
printf
(
"Received TX samples for antenna %d, nsamps %d (%d)
\n
"
,
antenna_index
,
nsamps
,(
bytes_received
>>
2
));
break
;
}
// rrh_exit = 1;
}
}
...
...
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