Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
trx-ecpri
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
nexedi
trx-ecpri
Commits
a448e929
Commit
a448e929
authored
Dec 26, 2024
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
7378b8be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
46 deletions
+59
-46
trx_ecpri.c
trx_ecpri.c
+59
-46
No files found.
trx_ecpri.c
View file @
a448e929
...
...
@@ -83,6 +83,15 @@ eCPRI concatenated frames
| Header #0 | | | Header #1 | |
+-----------+------------------+---------+-----------+------------------+
IQ sample pair: 32 bit (4 bytes)
IQ / second / antenna: 30 720 000
IQ payload per frame: 8832 bytes = 2208 IQ samples
IQ throughput (4 * 20 MHz): 3 932 160 000 bytes
1 radio frame = 10 subframes
1 subframe = 2 slots
1 slot = 7 symbols
*/
typedef
struct
{
...
...
@@ -154,7 +163,7 @@ static volatile counter_stat_t rx_drop_counter; // frames sent to RRH
static
volatile
counter_stat_t
tx_drop_counter
;
// frames sent to RRH
// Network
static
volatile
in
t
seq_id
;
static
volatile
uint8_
t
seq_id
;
static
volatile
uint8_t
frame_id
;
static
volatile
uint8_t
sub_frame_id
;
static
volatile
uint8_t
slot_id
;
...
...
@@ -444,59 +453,63 @@ static void *encode_thread(void *p) {
// If there are frames from trx_write callback to encode
if
(
to_write
&&
to_read
)
{
data
=
rbuf_write
(
&
tx_rbuf
);
memcpy
(
data
,
packet_header
,
PACKET_HEADER
);
j
=
ETHERNET_HEADER
+
ECPRI_COMMON_HEADER
;
// SEQ_ID
*
((
uint16_t
*
)
data
[
j
+
2
])
=
htons
(
seq_id
++
);
j
=
ETHERNET_HEADER
+
ECPRI_IQ_HEADER
;
// ORAN counters
data
[
j
+
1
]
=
frame_id
;
16
_bit
=
(
uint16_t
*
)
data
[
j
+
2
];
*
16
_bit
=
sub_frame_id
<<
8
;
*
16
_bit
|=
slot_id
<<
4
;
*
16
_bit
|=
symbol_id
;
for
(
uint16_t
antenna_id
=
0
;
antenna_id
<
4
;
antenna_id
++
)
{
data
=
rbuf_write
(
&
tx_rbuf
);
memcpy
(
data
,
packet_header
,
PACKET_HEADER
);
j
=
ETHERNET_HEADER
+
ECPRI_COMMON_HEADER
;
// PC_ID
*
((
uint16_t
*
)
data
[
j
+
0
])
=
htons
(
antenna_id
);
// SEQ_ID
*
((
uint16_t
*
)
data
[
j
+
2
])
=
htons
(
seq_id
++
<<
8
+
0x80
);
j
=
ETHERNET_HEADER
+
ECPRI_IQ_HEADER
;
// ORAN counters
data
[
j
+
1
]
=
frame_id
;
16
_bit
=
(
uint16_t
*
)
data
[
j
+
2
];
*
16
_bit
=
sub_frame_id
<<
8
;
*
16
_bit
|=
slot_id
<<
4
;
*
16
_bit
|=
symbol_id
;
// 8832 bytes of IQ samples
// TODO
int
nc
;
int
nf
=
8832
;
while
((
nc
=
rbuf_contiguous_copy
(
&
trxw_rbuf
[
antenna_id
],
&
tx_rbuf
,
nf
)))
{
memcpy
(
data
[
PACKET_HEADER
]
+
(
8832
-
nf
),
rbuf_read
(
&
trxw_rbuf
[
antenna_id
],
8832
-
nf
),
nc
);
rbuf_increment_read
(
&
trxw_rbuf
[
antenna_id
],
nc
);
tx_rbuf
.
write_index
=
(
tx_rbuf
.
write_index
+
nc
)
%
tx_rbuf
.
buf_len
;
trxw_rbuf
[
0
].
read_index
=
(
trxw_rbuf
[
0
].
read_index
+
nc
)
%
trxw_rbuf
[
0
].
buf_len
;
nf
-=
nc
;
}
if
(
nf
)
exit
(
EXIT_FAILURE
);
}
update_counter
(
&
encode_counter
,
nb_frames
);
/* How to compute counters:
- How much IQ samples are sent ?
- How much IQ samples / second ?
*/
if
(
!
g
->
count
)
{
rbuf_update_read_index
(
&
trxw_group_rbuf
);
}
frame_id
=
(
frame_id
+
1
)
%
100
;
sub_frame_id
=
(
frame_id
+
1
)
%
100
;
}
// TODO
int
nc
;
int
nf
=
nb_frames
;
while
((
nc
=
rbuf_contiguous_copy
(
&
trxw_rbuf
[
0
],
&
tx_rbuf
,
nf
)))
{
Complex
*
iq_samples
[
4
];
uint8_t
*
buf
=
RBUF_WRITE0
(
tx_rbuf
,
uint8_t
)
+
8
;
for
(
int
j
=
0
;
j
<
s
->
tx_n_channel
;
j
++
)
iq_samples
[
j
]
=
((
Complex
*
)
trxw_rbuf
[
j
].
buffer
)
+
(
trxw_rbuf
[
0
].
read_index
*
trxw_rbuf
[
0
].
len
);
for
(
int
i
=
0
;
i
<
nc
;
i
++
)
{
for
(
int
i
=
0
;
i
<
s
->
tx_n_channel
;
i
++
)
encode_s64_b60_2
(
buf
+
i
*
60
,
(
float
*
)
iq_samples
[
i
]);
*
((
uint16_t
*
)(
buf
-
2
))
=
htons
(
seq_id
++
);
for
(
int
j
=
0
;
j
<
s
->
tx_n_channel
;
j
++
)
iq_samples
[
j
]
+=
trxw_rbuf
[
0
].
len
;
buf
+=
tx_rbuf
.
len
;
slot_id
=
(
slot_id
+
1
)
%
2
;
if
(
!
slot_id
)
{
sub_frame_id
=
(
sub_frame_id
+
1
)
%
10
;
if
(
!
sub_frame_id
)
{
frame_id
=
(
frame_id
+
1
)
%
100
;
}
tx_rbuf
.
write_index
=
(
tx_rbuf
.
write_index
+
nc
)
%
tx_rbuf
.
buf_len
;
trxw_rbuf
[
0
].
read_index
=
(
trxw_rbuf
[
0
].
read_index
+
nc
)
%
trxw_rbuf
[
0
].
buf_len
;
nf
-=
nc
;
}
if
(
nf
)
exit
(
EXIT_FAILURE
);
}
update_counter
(
&
encode_counter
,
nb_frames
);
if
(
!
g
->
count
)
{
rbuf_update_read_index
(
&
trxw_group_rbuf
)
;
}
// TODO
int
nc
;
int
nf
=
nb_frames
;
}
}
pthread_exit
(
EXIT_SUCCESS
);
...
...
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