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
wangwenhui
OpenXG-RAN
Commits
18c3a323
Commit
18c3a323
authored
Dec 07, 2016
by
ROBERT Benoit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct issue #148 - protect whatchdog thread mutex unlock
parent
bf5bf8ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
+18
-6
No files found.
targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
View file @
18c3a323
...
...
@@ -297,6 +297,8 @@ static void *watchdog_thread(void *arg) {
int
first_acquisition
;
struct
timespec
sleep_time
,
wait
;
int
ret
;
wait
.
tv_sec
=
0
;
wait
.
tv_nsec
=
50000000L
;
...
...
@@ -404,10 +406,10 @@ static void *watchdog_thread(void *arg) {
first_acquisition
=
1
;
printf
(
"Locking watchdog for first acquisition
\n
"
);
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
ret
=
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
// main loop to keep up with DMA transfers from exmimo2
int
cnt_diff0
=
0
;
unsigned
long
long
cnt_diff0
=
0
;
while
((
!
oai_exit
)
&&
(
!
exm
->
watchdog_exit
))
{
if
(
exm
->
daq_state
==
running
)
{
...
...
@@ -424,7 +426,15 @@ static void *watchdog_thread(void *arg) {
exm
->
last_mbox
=
mbox
;
if
(
first_acquisition
==
0
)
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
{
ret
=
pthread_mutex_timedlock
(
&
exm
->
watchdog_mutex
,
&
wait
);
if
(
ret
)
{
// exm->watchdog_exit = 1;
printf
(
"watchdog_thread pthread_mutex_timedlock error = %d
\n
"
,
ret
);
continue
;
}
}
exm
->
ts
+=
(
diff
*
exm
->
samples_per_frame
/
150
)
;
...
...
@@ -433,7 +443,7 @@ static void *watchdog_thread(void *arg) {
(
diff
>
16
)
&&
(
first_acquisition
==
0
))
{
// we're too late so exit
exm
->
watchdog_exit
=
1
;
printf
(
"exiting, too late to keep up
\n
"
);
printf
(
"exiting, too late to keep up
- diff = %d
\n
"
,
diff
);
}
first_acquisition
=
0
;
...
...
@@ -442,7 +452,7 @@ static void *watchdog_thread(void *arg) {
cnt_diff0
++
;
if
(
cnt_diff0
==
10
)
{
exm
->
watchdog_exit
=
1
;
printf
(
"exiting, HW stopped
\n
"
);
printf
(
"exiting, HW stopped
%llu
\n
"
,
cnt_diff0
);
}
}
else
...
...
@@ -453,9 +463,11 @@ static void *watchdog_thread(void *arg) {
(
exm
->
ts
-
exm
->
last_ts_rx
>
exm
->
samples_per_frame
))
{
exm
->
watchdog_exit
=
1
;
printf
(
"RX Overflow, exiting (TS %llu, TS last read %llu)
\n
"
,
exm
->
ts
,
exm
->
last_ts_rx
);
(
long
long
unsigned
int
)
exm
->
ts
,(
long
long
unsigned
int
)
exm
->
last_ts_rx
);
}
// printf("ts %lu, last_ts_rx %lu, mbox %d, diff %d\n",exm->ts, exm->last_ts_rx,mbox,diff);
if
(
!
ret
)
pthread_mutex_unlock
(
&
exm
->
watchdog_mutex
);
}
else
{
...
...
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