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
常顺宇
OpenXG-RAN
Commits
83a4bde6
Commit
83a4bde6
authored
Nov 19, 2014
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@6037
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
7e64422f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
+18
-16
No files found.
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
View file @
83a4bde6
...
...
@@ -94,9 +94,9 @@ int ethernet_socket_init(int Mod_id, char *dest_ip,int dest_port)
int
ethernet_write_data
(
int
Mod_id
,
openair0_timestamp
timestamp
,
const
void
*
buff
,
int
antenna_id
,
int
nsamps
)
{
int
ethernet_write_data
(
int
Mod_id
,
openair0_timestamp
timestamp
,
const
void
*
*
buff
,
int
antenna_id
,
int
nsamps
)
{
void
*
buff2
=
(
void
*
)
buff
-
sizeof
(
openair0_timestamp
)
-
(
sizeof
(
int16_t
)
*
2
);
void
*
buff2
=
(
void
*
)
buff
[
antenna_id
]
-
sizeof
(
openair0_timestamp
)
-
(
sizeof
(
int16_t
)
*
2
);
int32_t
temp0
=
*
(
int32_t
*
)
buff2
;
openair0_timestamp
temp1
=
*
(
openair0_timestamp
*
)(
buff2
+
(
sizeof
(
int16_t
)
*
2
));
...
...
@@ -116,6 +116,7 @@ int ethernet_write_data(int Mod_id, openair0_timestamp timestamp, const void *bu
(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
dest_addr_len
[
Mod_id
]))
<
0
)
{
printf
(
"Send failed for Mod_id %d
\n
"
,
Mod_id
);
perror
(
"ETHERNET:"
);
exit
(
-
1
);
}
}
...
...
@@ -126,10 +127,10 @@ int ethernet_write_data(int Mod_id, openair0_timestamp timestamp, const void *bu
}
int
ethernet_read_data
(
int
Mod_id
,
openair0_timestamp
*
timestamp
,
void
*
buff
,
int
antenna_id
,
int
nsamps
)
{
int
ethernet_read_data
(
int
Mod_id
,
openair0_timestamp
*
timestamp
,
void
*
*
buff
,
int
antenna_id
,
int
nsamps
)
{
void
*
buff2
=
buff
-
sizeof
(
openair0_timestamp
);
int
sampl
es_received
;
void
*
buff2
=
buff
[
antenna_id
]
-
sizeof
(
openair0_timestamp
);
int
byt
es_received
;
int
block_cnt
;
int
ret
;
openair0_timestamp
temp
=
*
(
openair0_timestamp
*
)
buff2
;
...
...
@@ -145,16 +146,17 @@ int ethernet_read_data(int Mod_id,openair0_timestamp *timestamp,void *buff, int
sendto
(
sockfd
[
Mod_id
],
mesg
,
4
,
0
,(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
dest_addr_len
[
Mod_id
]);
sampl
es_received
=-
sizeof
(
openair0_timestamp
);
byt
es_received
=-
sizeof
(
openair0_timestamp
);
block_cnt
=
0
;
while
(
samples_received
<
(
int
)((
nsamps
<<
2
)))
{
while
(
bytes_received
<
(
int
)((
nsamps
<<
2
)))
{
printf
(
"requesting %d bytes
\n
"
,(
nsamps
<<
2
)
-
bytes_received
);
ret
=
recvfrom
(
sockfd
[
Mod_id
],
&
buff2
[
sampl
es_received
],
(
nsamps
<<
2
)
+
sizeof
(
openair0_timestamp
)
-
sampl
es_received
,
&
buff2
[
byt
es_received
],
(
nsamps
<<
2
)
-
byt
es_received
,
0
,
//MSG_DONTWAIT,
(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
&
dest_addr_len
[
Mod_id
]);
printf
(
"
samples_received %d (ret %d)
\n
"
,
sampl
es_received
+
ret
,
ret
);
printf
(
"
bytes_received %d (ret %d)
\n
"
,
byt
es_received
+
ret
,
ret
);
if
(
ret
==-
1
)
{
if
(
errno
==
EAGAIN
)
{
perror
(
"ETHERNET: "
);
...
...
@@ -167,15 +169,15 @@ int ethernet_read_data(int Mod_id,openair0_timestamp *timestamp,void *buff, int
}
}
else
{
sampl
es_received
+=
ret
;
byt
es_received
+=
ret
;
}
}
*
timestamp
=
*
(
openair0_timestamp
*
)(
buff
-
sizeof
(
openair0_timestamp
));
printf
(
"Received %d samples, timestamp = %d
\n
"
,
sampl
es_received
>>
2
,
*
timestamp
);
printf
(
"Received %d samples, timestamp = %d
\n
"
,
byt
es_received
>>
2
,
*
timestamp
);
*
(
openair0_timestamp
*
)(
buff
-
sizeof
(
openair0_timestamp
))
=
temp
;
return
sampl
es_received
>>
2
;
return
byt
es_received
>>
2
;
}
...
...
@@ -186,17 +188,17 @@ int trx_eth_start(openair0_device *openair0) {
}
void
trx_eth_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
const
void
*
buff
,
int
nsamps
,
int
cc
,
int
flags
)
void
trx_eth_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
const
void
*
*
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
int
i
;
for
(
i
=
0
;
i
<
cc
;
i
++
)
ethernet_write_data
(
device
->
Mod_id
,
timestamp
,
buff
,
i
,
nsamps
);
}
int
trx_eth_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
*
buff
,
int
nsamps
,
int
cc
)
{
int
trx_eth_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
*
*
buff
,
int
nsamps
,
int
cc
)
{
int
i
;
for
(
i
=
0
;
i
<
cc
;
i
++
)
return
(
ethernet_read_data
(
device
->
Mod_id
,
ptimestamp
,
buff
,
0
,
nsamps
));
return
(
ethernet_read_data
(
device
->
Mod_id
,
ptimestamp
,
buff
,
i
,
nsamps
));
}
...
...
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