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
aa18ab2d
Commit
aa18ab2d
authored
Jan 20, 2025
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
cb30fa03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
19 deletions
+6
-19
ring_buffer.c
ring_buffer.c
+4
-6
trx_ecpri.c
trx_ecpri.c
+2
-13
No files found.
ring_buffer.c
View file @
aa18ab2d
...
...
@@ -47,8 +47,10 @@ typedef struct {
static
void
init_rbuf
(
ring_buffer_t
*
rbuf
,
char
*
name
,
size_t
buf_len
,
size_t
block_len
)
{
//log_debug("TRX_ECPRI", "Allocating %s with %d bytes\n", _name, len);
if
(
!
(
buf_len
%
block_len
))
log_error
(
"INIT_RBUF"
,
"buf_len needs to be a multiple of block_len"
);
if
((
buf_len
%
block_len
))
log_error
(
"INIT_RBUF"
,
"buf_len needs to be a multiple of block_len (%d is not a multiple of %d)"
,
buf_len
,
block_len
);
rbuf
->
buf_len
=
buf_len
;
rbuf
->
block_len
=
block_len
;
rbuf
->
buffer
=
(
uint8_t
*
)
malloc
(
buf_len
);
...
...
@@ -69,13 +71,9 @@ static uint8_t * rbuf_write(ring_buffer_t * rbuf) {
return
rbuf
->
buffer
+
rbuf
->
write_index
;
}
static
void
rbuf_increment_write
(
ring_buffer_t
*
rbuf
,
size_t
size
)
{
if
(
!
(
size
%
rbuf
->
block_len
))
log_error
(
"RBUF"
,
"size needs to be a multiple of buffer block length"
);
rbuf
->
write_index
=
(
rbuf
->
write_index
+
size
)
%
rbuf
->
buf_len
;
}
static
void
rbuf_increment_read
(
ring_buffer_t
*
rbuf
,
size_t
size
)
{
if
(
!
(
size
%
rbuf
->
block_len
))
log_error
(
"RBUF"
,
"size needs to be a multiple of buffer block length"
);
rbuf
->
read_index
=
(
rbuf
->
read_index
+
size
)
%
rbuf
->
buf_len
;
}
static
uint8_t
*
rbuf_read
(
ring_buffer_t
*
rbuf
)
{
...
...
trx_ecpri.c
View file @
aa18ab2d
...
...
@@ -118,7 +118,6 @@ typedef struct {
int
decode_affinity
;
int
statistic_affinity
;
int
ecpri_period
;
int
flow_id
;
int
frame_frequency
;
...
...
@@ -128,8 +127,6 @@ typedef struct {
int
monitor_pps
;
int
monitor_trigger_duration
;
int
start_sending
;
int
start_receiving
;
int
rx_n_channel
;
int
tx_n_channel
;
int
statistics_refresh_rate_ns
;
...
...
@@ -713,12 +710,12 @@ int start(TRXEcpriState * s) {
for
(
int
i
=
0
;
i
<
s
->
tx_n_channel
;
i
++
)
{
char
name
[
256
];
sprintf
(
name
,
"TRXWrite Ring Buffer %d"
,
i
);
init_rbuf
(
&
trxw_rbuf
[
i
],
name
,
s
->
trx_buf_size
,
sizeof
(
Complex
)
*
32
);
init_rbuf
(
&
trxw_rbuf
[
i
],
name
,
s
->
trx_buf_size
,
sizeof
(
Complex
));
}
for
(
int
i
=
0
;
i
<
s
->
rx_n_channel
;
i
++
)
{
char
name
[
256
];
sprintf
(
name
,
"TRXRead Ring Buffer %d"
,
i
);
init_rbuf
(
&
trxr_rbuf
[
i
],
name
,
s
->
trx_buf_size
,
sizeof
(
Complex
)
*
32
);
init_rbuf
(
&
trxr_rbuf
[
i
],
name
,
s
->
trx_buf_size
,
sizeof
(
Complex
));
}
memset
((
uint8_t
*
)
packet_header
,
0
,
PACKET_HEADER
);
...
...
@@ -1143,21 +1140,13 @@ int trx_driver_init(TRXState *s1)
s
->
monitor_pps
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"monitor_trigger_duration"
);
s
->
monitor_trigger_duration
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"start_sending"
);
s
->
start_sending
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"start_receiving"
);
s
->
start_receiving
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"rx_n_channel"
);
s
->
rx_n_channel
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"tx_n_channel"
);
s
->
tx_n_channel
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"statistics_refresh_rate_ns"
);
s
->
statistics_refresh_rate_ns
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"ecpri_period"
);
s
->
ecpri_period
=
(
int
)
val
;
if
(
s
->
ecpri_period
==
0
)
log_exit
(
"TRX_ECPRI"
,
"ecpri_period parameter can't be null
\n
"
);
if
(
s
->
rx_n_channel
==
0
)
log_exit
(
"TRX_ECPRI"
,
"rx_n_channel parameter can't be null
\n
"
);
if
(
s
->
tx_n_channel
==
0
)
...
...
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