Kinetis: Add atomic and non-atomic HRT calls

This reduces interrupt load significantly.
This commit is contained in:
Lorenz Meier
2019-01-22 23:52:57 +01:00
parent c6718a5bca
commit 27cae912d1
+11
View File
@@ -599,6 +599,17 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
*/
hrt_abstime
hrt_elapsed_time(const volatile hrt_abstime *then)
{
hrt_abstime delta = hrt_absolute_time() - *then;
return delta;
}
/**
* Compare a time value with the current time as atomic operation.
*/
hrt_abstime
hrt_elapsed_time_atomic(const volatile hrt_abstime *then)
{
irqstate_t flags = px4_enter_critical_section();