Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
ccefc640
Commit
ccefc640
authored
6 years ago
by
Beat Küng
Committed by
Julian Oes
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
drv_hrt posix: remove unused code and remove locking from hrt_absolute_time
parent
5f0e6d70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
platforms/posix/src/px4_layer/drv_hrt.cpp
+2
-73
2 additions, 73 deletions
platforms/posix/src/px4_layer/drv_hrt.cpp
src/drivers/drv_hrt.h
+0
-19
0 additions, 19 deletions
src/drivers/drv_hrt.h
with
2 additions
and
92 deletions
platforms/posix/src/px4_layer/drv_hrt.cpp
+
2
−
73
View file @
ccefc640
...
...
@@ -67,11 +67,6 @@ static hrt_abstime px4_timestart_monotonic = 0;
static
int32_t
dsp_offset
=
0
;
#endif
static
hrt_abstime
_start_delay_time
=
0
;
static
hrt_abstime
_delay_interval
=
0
;
static
hrt_abstime
max_time
=
0
;
static
pthread_mutex_t
_hrt_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
#if defined(ENABLE_LOCKSTEP_SCHEDULER)
static
LockstepScheduler
lockstep_scheduler
;
#endif
...
...
@@ -80,7 +75,6 @@ static LockstepScheduler lockstep_scheduler;
hrt_abstime
hrt_absolute_time_offset
();
static
void
hrt_call_reschedule
();
static
void
hrt_call_invoke
();
static
hrt_abstime
_hrt_absolute_time_internal
();
__EXPORT
hrt_abstime
hrt_reset
();
hrt_abstime
hrt_absolute_time_offset
()
...
...
@@ -158,7 +152,7 @@ uint64_t hrt_system_time()
/*
* Get absolute time.
*/
hrt_abstime
_
hrt_absolute_time
_internal
()
hrt_abstime
hrt_absolute_time
()
{
struct
timespec
ts
;
px4_clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
);
...
...
@@ -177,42 +171,12 @@ int hrt_set_absolute_time_offset(int32_t time_diff_us)
}
#endif
/*
* Get absolute time.
*/
hrt_abstime
hrt_absolute_time
()
{
pthread_mutex_lock
(
&
_hrt_mutex
);
hrt_abstime
ret
;
if
(
_start_delay_time
>
0
)
{
ret
=
_start_delay_time
;
}
else
{
ret
=
_hrt_absolute_time_internal
();
}
ret
-=
_delay_interval
;
if
(
ret
<
max_time
)
{
PX4_ERR
(
"WARNING! TIME IS NEGATIVE! %d vs %d"
,
(
int
)
ret
,
(
int
)
max_time
);
ret
=
max_time
;
}
max_time
=
ret
;
pthread_mutex_unlock
(
&
_hrt_mutex
);
return
ret
;
}
hrt_abstime
hrt_reset
()
{
#ifndef __PX4_QURT
px4_timestart_monotonic
=
0
;
#endif
max_time
=
0
;
return
_hrt_absolute_time_internal
();
return
hrt_absolute_time
();
}
/*
...
...
@@ -317,41 +281,6 @@ void hrt_init()
memset
(
&
_hrt_work
,
0
,
sizeof
(
_hrt_work
));
}
void
hrt_start_delay
()
{
pthread_mutex_lock
(
&
_hrt_mutex
);
_start_delay_time
=
_hrt_absolute_time_internal
();
pthread_mutex_unlock
(
&
_hrt_mutex
);
}
void
hrt_stop_delay_delta
(
hrt_abstime
delta
)
{
pthread_mutex_lock
(
&
_hrt_mutex
);
uint64_t
delta_measured
=
_hrt_absolute_time_internal
()
-
_start_delay_time
;
if
(
delta_measured
<
delta
)
{
delta
=
delta_measured
;
}
_delay_interval
+=
delta
;
_start_delay_time
=
0
;
pthread_mutex_unlock
(
&
_hrt_mutex
);
}
void
hrt_stop_delay
()
{
pthread_mutex_lock
(
&
_hrt_mutex
);
uint64_t
delta
=
_hrt_absolute_time_internal
()
-
_start_delay_time
;
_delay_interval
+=
delta
;
_start_delay_time
=
0
;
pthread_mutex_unlock
(
&
_hrt_mutex
);
}
static
void
hrt_call_enter
(
struct
hrt_call
*
entry
)
{
...
...
This diff is collapsed.
Click to expand it.
src/drivers/drv_hrt.h
+
0
−
19
View file @
ccefc640
...
...
@@ -173,25 +173,6 @@ __EXPORT extern void hrt_init(void);
#ifdef __PX4_POSIX
/**
* Start to delay the HRT return value.
*
* Until hrt_stop_delay() is called the HRT calls will return the timestamp
* at the instance then hrt_start_delay() was called.
*/
__EXPORT
extern
void
hrt_start_delay
(
void
);
/**
* Stop to delay the HRT.
*/
__EXPORT
extern
void
hrt_stop_delay
(
void
);
/**
* Stop to delay the HRT, but with an exact delta time.
*/
__EXPORT
extern
void
hrt_stop_delay_delta
(
hrt_abstime
delta
);
__EXPORT
extern
hrt_abstime
hrt_reset
(
void
);
__EXPORT
extern
hrt_abstime
hrt_absolute_time_offset
(
void
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment