Browse Source

drv_hrt: inline hrt_elapsed_time

GCC did not do that.
sbg
Beat Küng 6 years ago
parent
commit
74a3c378b2
  1. 13
      platforms/posix/src/px4_layer/drv_hrt.cpp
  2. 5
      src/drivers/drv_hrt.h
  3. 11
      src/drivers/kinetis/drv_hrt.c
  4. 11
      src/drivers/samv7/drv_hrt.c
  5. 11
      src/drivers/stm32/drv_hrt.c

13
platforms/posix/src/px4_layer/drv_hrt.cpp

@ -198,19 +198,6 @@ hrt_abstime ts_to_abstime(const struct timespec *ts) @@ -198,19 +198,6 @@ hrt_abstime ts_to_abstime(const struct timespec *ts)
return result;
}
/*
* Compute the delta between a timestamp taken in the past
* and now.
*
* This function is safe to use even if the timestamp is updated
* by an interrupt during execution.
*/
hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
{
hrt_abstime delta = hrt_absolute_time() - *then;
return delta;
}
/*
* Compute the delta between a timestamp taken in the past
* and now.

5
src/drivers/drv_hrt.h

@ -98,7 +98,10 @@ __EXPORT extern void abstime_to_ts(struct timespec *ts, hrt_abstime abstime); @@ -98,7 +98,10 @@ __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 hrt_abstime *then);
static inline hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
{
return hrt_absolute_time() - *then;
}
/**
* Compute the delta between a timestamp taken in the past

11
src/drivers/kinetis/drv_hrt.c

@ -594,17 +594,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime) @@ -594,17 +594,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
ts->tv_nsec = abstime * 1000;
}
/**
* Compare a time value with the current time.
*/
hrt_abstime
hrt_elapsed_time(const hrt_abstime *then)
{
hrt_abstime delta = hrt_absolute_time() - *then;
return delta;
}
/**
* Compare a time value with the current time as atomic operation.
*/

11
src/drivers/samv7/drv_hrt.c

@ -675,17 +675,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime) @@ -675,17 +675,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
ts->tv_nsec = abstime * 1000;
}
/**
* Compare a time value with the current time.
*/
hrt_abstime
hrt_elapsed_time(const hrt_abstime *then)
{
hrt_abstime delta = hrt_absolute_time() - *then;
return delta;
}
/**
* Compare a time value with the current time as atomic operation.
*/

11
src/drivers/stm32/drv_hrt.c

@ -715,17 +715,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime) @@ -715,17 +715,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
ts->tv_nsec = abstime * 1000;
}
/**
* Compare a time value with the current time.
*/
hrt_abstime
hrt_elapsed_time(const hrt_abstime *then)
{
hrt_abstime delta = hrt_absolute_time() - *then;
return delta;
}
/**
* Compare a time value with the current time as atomic operation
*/

Loading…
Cancel
Save