From 46390a150833be226a7ab298aa414b748580cea9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier <lorenz@px4.io> Date: Tue, 22 Jan 2019 22:29:39 +0100 Subject: [PATCH] HRT: Drop volatile specifier from function call for non-atomic mode This allows the compiler to optimize better without loosing any performance / accuracy. --- src/drivers/drv_hrt.h | 2 +- src/drivers/kinetis/drv_hrt.c | 2 +- src/drivers/samv7/drv_hrt.c | 2 +- src/drivers/stm32/drv_hrt.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drivers/drv_hrt.h b/src/drivers/drv_hrt.h index 17fe4ba107..4f4787ab16 100644 --- a/src/drivers/drv_hrt.h +++ b/src/drivers/drv_hrt.h @@ -98,7 +98,7 @@ __EXPORT extern void abstime_to_ts(struct timespec *ts, hrt_abstime abstime); * * This function is not interrupt save. */ -__EXPORT extern hrt_abstime hrt_elapsed_time(const volatile hrt_abstime *then); +__EXPORT extern hrt_abstime hrt_elapsed_time(const hrt_abstime *then); /** * Compute the delta between a timestamp taken in the past diff --git a/src/drivers/kinetis/drv_hrt.c b/src/drivers/kinetis/drv_hrt.c index f1c046ff84..9a221223bc 100644 --- a/src/drivers/kinetis/drv_hrt.c +++ b/src/drivers/kinetis/drv_hrt.c @@ -598,7 +598,7 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime) * Compare a time value with the current time. */ hrt_abstime -hrt_elapsed_time(const volatile hrt_abstime *then) +hrt_elapsed_time(const hrt_abstime *then) { hrt_abstime delta = hrt_absolute_time() - *then; diff --git a/src/drivers/samv7/drv_hrt.c b/src/drivers/samv7/drv_hrt.c index a38e42de5a..7be4bbb487 100644 --- a/src/drivers/samv7/drv_hrt.c +++ b/src/drivers/samv7/drv_hrt.c @@ -679,7 +679,7 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime) * Compare a time value with the current time. */ hrt_abstime -hrt_elapsed_time(const volatile hrt_abstime *then) +hrt_elapsed_time(const hrt_abstime *then) { hrt_abstime delta = hrt_absolute_time() - *then; diff --git a/src/drivers/stm32/drv_hrt.c b/src/drivers/stm32/drv_hrt.c index f44ad15245..c247cb2209 100644 --- a/src/drivers/stm32/drv_hrt.c +++ b/src/drivers/stm32/drv_hrt.c @@ -719,7 +719,7 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime) * Compare a time value with the current time. */ hrt_abstime -hrt_elapsed_time(const volatile hrt_abstime *then) +hrt_elapsed_time(const hrt_abstime *then) { hrt_abstime delta = hrt_absolute_time() - *then; -- GitLab