SAMv7: 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 27cae912d1
commit bca0f7925c
+11
View File
@@ -680,6 +680,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 = enter_critical_section();