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
littleBu
OpenXG-RAN
Commits
69cf59f3
Commit
69cf59f3
authored
2 years ago
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop USRP write thread if necessary
parent
e28bd9ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
targets/ARCH/COMMON/common_lib.h
targets/ARCH/COMMON/common_lib.h
+2
-0
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+19
-0
No files found.
targets/ARCH/COMMON/common_lib.h
View file @
69cf59f3
...
@@ -310,6 +310,8 @@ typedef struct {
...
@@ -310,6 +310,8 @@ typedef struct {
pthread_cond_t
cond_write
;
pthread_cond_t
cond_write
;
/// mutex for trx write thread
/// mutex for trx write thread
pthread_mutex_t
mutex_write
;
pthread_mutex_t
mutex_write
;
/// to inform the thread to exit
bool
write_thread_exit
;
}
openair0_thread_t
;
}
openair0_thread_t
;
/*!\brief structure holds the parameters to configure USRP devices */
/*!\brief structure holds the parameters to configure USRP devices */
...
...
This diff is collapsed.
Click to expand it.
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
69cf59f3
...
@@ -309,6 +309,9 @@ static int trx_usrp_start(openair0_device *device) {
...
@@ -309,6 +309,9 @@ static int trx_usrp_start(openair0_device *device) {
return
0
;
return
0
;
}
}
static
void
trx_usrp_write_reset
(
openair0_thread_t
*
wt
);
/*! \brief Terminate operation of the USRP transceiver -- free all associated resources
/*! \brief Terminate operation of the USRP transceiver -- free all associated resources
* \param device the hardware to use
* \param device the hardware to use
*/
*/
...
@@ -322,6 +325,8 @@ static void trx_usrp_end(openair0_device *device) {
...
@@ -322,6 +325,8 @@ static void trx_usrp_end(openair0_device *device) {
iqrecorder_end
(
device
);
iqrecorder_end
(
device
);
LOG_I
(
HW
,
"releasing USRP
\n
"
);
LOG_I
(
HW
,
"releasing USRP
\n
"
);
if
(
usrp_tx_thread
!=
0
)
trx_usrp_write_reset
(
&
device
->
write_thread
);
s
->
tx_stream
->~
tx_streamer
();
s
->
tx_stream
->~
tx_streamer
();
s
->
rx_stream
->~
rx_streamer
();
s
->
rx_stream
->~
rx_streamer
();
...
@@ -518,6 +523,8 @@ void *trx_usrp_write_thread(void * arg){
...
@@ -518,6 +523,8 @@ void *trx_usrp_write_thread(void * arg){
while
(
write_thread
->
count_write
==
0
)
{
while
(
write_thread
->
count_write
==
0
)
{
pthread_cond_wait
(
&
write_thread
->
cond_write
,
&
write_thread
->
mutex_write
);
// this unlocks mutex_rxtx while waiting and then locks it again
pthread_cond_wait
(
&
write_thread
->
cond_write
,
&
write_thread
->
mutex_write
);
// this unlocks mutex_rxtx while waiting and then locks it again
}
}
if
(
write_thread
->
write_thread_exit
)
break
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD
,
1
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD
,
1
);
s
=
(
usrp_state_t
*
)
device
->
priv
;
s
=
(
usrp_state_t
*
)
device
->
priv
;
start
=
write_thread
->
start
;
start
=
write_thread
->
start
;
...
@@ -612,6 +619,7 @@ int trx_usrp_write_init(openair0_device *device){
...
@@ -612,6 +619,7 @@ int trx_usrp_write_init(openair0_device *device){
write_thread
->
start
=
0
;
write_thread
->
start
=
0
;
write_thread
->
end
=
0
;
write_thread
->
end
=
0
;
write_thread
->
count_write
=
0
;
write_thread
->
count_write
=
0
;
write_thread
->
write_thread_exit
=
false
;
printf
(
"end of tx write thread
\n
"
);
printf
(
"end of tx write thread
\n
"
);
pthread_mutex_init
(
&
write_thread
->
mutex_write
,
NULL
);
pthread_mutex_init
(
&
write_thread
->
mutex_write
,
NULL
);
pthread_cond_init
(
&
write_thread
->
cond_write
,
NULL
);
pthread_cond_init
(
&
write_thread
->
cond_write
,
NULL
);
...
@@ -620,6 +628,17 @@ int trx_usrp_write_init(openair0_device *device){
...
@@ -620,6 +628,17 @@ int trx_usrp_write_init(openair0_device *device){
return
(
0
);
return
(
0
);
}
}
static
void
trx_usrp_write_reset
(
openair0_thread_t
*
wt
)
{
pthread_mutex_lock
(
&
wt
->
mutex_write
);
wt
->
count_write
=
1
;
wt
->
write_thread_exit
=
true
;
pthread_mutex_unlock
(
&
wt
->
mutex_write
);
pthread_cond_signal
(
&
wt
->
cond_write
);
void
*
retval
=
NULL
;
pthread_join
(
wt
->
pthread_write
,
&
retval
);
LOG_I
(
HW
,
"stopped USRP write thread
\n
"
);
}
//---------------------end-------------------------
//---------------------end-------------------------
/*! \brief Receive samples from hardware.
/*! \brief Receive samples from hardware.
...
...
This diff is collapsed.
Click to expand it.
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