mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:28:53 +08:00
SAMv7: Add atomic and non-atomic HRT calls
This reduces interrupt load significantly.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user