Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shweta Shrivastava
openairinterface5G
Commits
83a4bde6
Commit
83a4bde6
authored
10 years ago
by
knopp
Browse files
Options
Downloads
Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@6037
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
7e64422f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
+18
-16
18 additions, 16 deletions
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
with
18 additions
and
16 deletions
targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
+
18
−
16
View file @
83a4bde6
...
@@ -94,9 +94,9 @@ int ethernet_socket_init(int Mod_id, char *dest_ip,int dest_port)
...
@@ -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
;
int32_t
temp0
=
*
(
int32_t
*
)
buff2
;
openair0_timestamp
temp1
=
*
(
openair0_timestamp
*
)(
buff2
+
(
sizeof
(
int16_t
)
*
2
));
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
...
@@ -116,6 +116,7 @@ int ethernet_write_data(int Mod_id, openair0_timestamp timestamp, const void *bu
(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
dest_addr_len
[
Mod_id
]))
<
0
)
{
dest_addr_len
[
Mod_id
]))
<
0
)
{
printf
(
"Send failed for Mod_id %d
\n
"
,
Mod_id
);
printf
(
"Send failed for Mod_id %d
\n
"
,
Mod_id
);
perror
(
"ETHERNET:"
);
exit
(
-
1
);
exit
(
-
1
);
}
}
}
}
...
@@ -126,10 +127,10 @@ int ethernet_write_data(int Mod_id, openair0_timestamp timestamp, const void *bu
...
@@ -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
);
void
*
buff2
=
buff
[
antenna_id
]
-
sizeof
(
openair0_timestamp
);
int
sampl
es_received
;
int
byt
es_received
;
int
block_cnt
;
int
block_cnt
;
int
ret
;
int
ret
;
openair0_timestamp
temp
=
*
(
openair0_timestamp
*
)
buff2
;
openair0_timestamp
temp
=
*
(
openair0_timestamp
*
)
buff2
;
...
@@ -145,16 +146,17 @@ int ethernet_read_data(int Mod_id,openair0_timestamp *timestamp,void *buff, int
...
@@ -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
]);
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
;
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
],
ret
=
recvfrom
(
sockfd
[
Mod_id
],
&
buff2
[
sampl
es_received
],
&
buff2
[
byt
es_received
],
(
nsamps
<<
2
)
+
sizeof
(
openair0_timestamp
)
-
sampl
es_received
,
(
nsamps
<<
2
)
-
byt
es_received
,
0
,
//MSG_DONTWAIT,
0
,
//MSG_DONTWAIT,
(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
&
dest_addr_len
[
Mod_id
]);
&
dest_addr_len
[
Mod_id
]);
printf
(
"
sampl
es_received %d (ret %d)
\n
"
,
sampl
es_received
+
ret
,
ret
);
printf
(
"
byt
es_received %d (ret %d)
\n
"
,
byt
es_received
+
ret
,
ret
);
if
(
ret
==-
1
)
{
if
(
ret
==-
1
)
{
if
(
errno
==
EAGAIN
)
{
if
(
errno
==
EAGAIN
)
{
perror
(
"ETHERNET: "
);
perror
(
"ETHERNET: "
);
...
@@ -167,15 +169,15 @@ int ethernet_read_data(int Mod_id,openair0_timestamp *timestamp,void *buff, int
...
@@ -167,15 +169,15 @@ int ethernet_read_data(int Mod_id,openair0_timestamp *timestamp,void *buff, int
}
}
}
}
else
{
else
{
sampl
es_received
+=
ret
;
byt
es_received
+=
ret
;
}
}
}
}
*
timestamp
=
*
(
openair0_timestamp
*
)(
buff
-
sizeof
(
openair0_timestamp
));
*
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
;
*
(
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) {
...
@@ -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
;
int
i
;
for
(
i
=
0
;
i
<
cc
;
i
++
)
for
(
i
=
0
;
i
<
cc
;
i
++
)
ethernet_write_data
(
device
->
Mod_id
,
timestamp
,
buff
,
i
,
nsamps
);
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
;
int
i
;
for
(
i
=
0
;
i
<
cc
;
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
));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment