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
8c4c2b82
Commit
8c4c2b82
authored
Jan 21, 2025
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encode thread works
parent
4f96c487
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
ring_buffer.c
ring_buffer.c
+8
-6
trx_ecpri.c
trx_ecpri.c
+9
-9
No files found.
ring_buffer.c
View file @
8c4c2b82
...
...
@@ -59,19 +59,21 @@ static void init_rbuf(ring_buffer_t * rbuf, char * name, size_t buf_len,
strcpy
(
rbuf
->
name
,
name
);
}
static
void
check_rbuf_read
(
ring_buffer_t
*
rbuf
)
{
if
((
rbuf
->
read_index
%
block_len
))
static
void
check_rbuf_read
(
ring_buffer_t
*
rbuf
,
void
(
*
log_exit
)(
const
char
*
,
const
char
*
msg
,
...))
{
if
((
rbuf
->
read_index
%
rbuf
->
block_len
))
log_exit
(
"CHECK_RBUF"
,
"read index needs to be a multiple of block_len"
" (%d is not a multiple of %d)"
,
rbuf
->
read_index
,
block_len
);
rbuf
->
read_index
,
rbuf
->
block_len
);
}
static
void
check_rbuf_write
(
ring_buffer_t
*
rbuf
)
{
if
((
rbuf
->
write_index
%
block_len
))
static
void
check_rbuf_write
(
ring_buffer_t
*
rbuf
,
void
(
*
log_exit
)(
const
char
*
,
const
char
*
msg
,
...))
{
if
((
rbuf
->
write_index
%
rbuf
->
block_len
))
log_exit
(
"CHECK_RBUF"
,
"write index needs to be a multiple of block_len"
" (%d is not a multiple of %d)"
,
rbuf
->
write
,
block_len
);
rbuf
->
write
_index
,
rbuf
->
block_len
);
}
static
int
rbuf_read_amount
(
ring_buffer_t
*
rbuf
)
{
...
...
trx_ecpri.c
View file @
8c4c2b82
...
...
@@ -204,7 +204,7 @@ static void print_debug(FILE * f, int print_header) {
for
(
int
i
=
0
;
buffer
[
i
]
!=
'\0'
;
i
++
)
if
(
buffer
[
i
]
==
' '
)
buffer
[
i
]
=
'-'
;
fprintf
(
f
,
buffer
);
fprintf
(
f
,
"%s"
,
buffer
);
}
sprintf
(
buffer
,
" "
...
...
@@ -232,7 +232,7 @@ static void print_debug(FILE * f, int print_header) {
for
(
int
i
=
0
;
buffer
[
i
]
!=
'\0'
;
i
++
)
if
(
buffer
[
i
]
==
' '
)
buffer
[
i
]
=
'-'
;
fprintf
(
f
,
buffer
);
fprintf
(
f
,
"%s"
,
buffer
);
}
static
void
print_stats
(
FILE
*
f
,
int
print_header
)
{
...
...
@@ -403,7 +403,7 @@ static void *recv_thread(void *p) {
"recvmmsg received %d messages instead of %d
\n
"
,
ret
,
RX_BURST_SIZE
);
rbuf_increment_write
(
&
rx_rbuf
,
RX_BURST_SIZE
*
PACKET_SIZE
);
update_counter
(
&
recv_counter
,
RX_BURST_SIZE
);
check_rbuf_write
(
&
rx_rbuf
);
check_rbuf_write
(
&
rx_rbuf
,
log_exit
);
}
pthread_exit
(
EXIT_SUCCESS
);
}
...
...
@@ -461,7 +461,7 @@ static void *send_thread(void *p) {
update_counter
(
&
sent_counter
,
ret
);
}
rbuf_increment_read
(
&
tx_rbuf
,
PACKET_SIZE
*
to_send
);
check_rbuf_read
(
&
tx_rbuf
);
check_rbuf_read
(
&
tx_rbuf
,
log_exit
);
}
pthread_exit
(
EXIT_SUCCESS
);
}
...
...
@@ -490,8 +490,8 @@ static void *encode_thread(void *p) {
// If we have frames to encode (is there space in TX buffer)
// And if there are frames from trx_write callback to encode
to_write
=
rbuf_write_amount
(
&
tx_rbuf
);
to_read
=
rbuf_read_amount
(
&
trxw_rbuf
[
0
]);
to_write
=
rbuf_write_amount
(
&
tx_rbuf
)
/
tx_rbuf
.
block_len
;
to_read
=
rbuf_read_amount
(
&
trxw_rbuf
[
0
])
/
trxw_rbuf
[
0
].
block_len
;
usleep
(
1
);
if
(
!
to_write
||
!
to_read
)
continue
;
...
...
@@ -518,9 +518,9 @@ static void *encode_thread(void *p) {
IQ_PAYLOAD
);
rbuf_increment_read
(
&
trxw_rbuf
[
antenna_id
],
IQ_PAYLOAD
);
rbuf_increment_write
(
&
tx_rbuf
,
PACKET_SIZE
);
check_rbuf_read
(
&
trxw_rbuf
[
antenna_id
]);
check_rbuf_read
(
&
trxw_rbuf
[
antenna_id
]
,
log_exit
);
}
check_rbuf_write
(
&
tx_rbuf
);
check_rbuf_write
(
&
tx_rbuf
,
log_exit
);
// Increment counter once we wrote packets for all channels
update_counter
(
&
encode_counter
,
1
);
...
...
@@ -571,7 +571,7 @@ static void *decode_thread(void *p) {
IQ_PAYLOAD
);
rbuf_increment_write
(
&
trxr_rbuf
[
antenna_id
],
IQ_PAYLOAD
);
rbuf_increment_read
(
&
rx_rbuf
,
PACKET_SIZE
);
check_rbuf_write
(
&
trxr_rbuf
[
antenna_id
]);
check_rbuf_write
(
&
trxr_rbuf
[
antenna_id
]
,
log_exit
);
update_counter
(
&
decode_counter
,
1
);
}
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