This commit is contained in:
2026-07-28 10:51:28 +08:00
parent 6d57f4f1ce
commit 3fbd4d34cd
+7
View File
@@ -1,5 +1,6 @@
#ifndef INCLUDED_OS_SYSTICK_H #ifndef INCLUDED_OS_SYSTICK_H
#define INCLUDED_OS_SYSTICK_H #define INCLUDED_OS_SYSTICK_H
#include <stdatomic.h>
#ifndef INCLUDED_OS_TYPES_H #ifndef INCLUDED_OS_TYPES_H
#include <os_types.h> #include <os_types.h>
@@ -88,4 +89,10 @@ os_tick_t os_systick_safe_get_in_isr(void) {
return ticks; return ticks;
} }
OS_STATIC_FORCE_INLINE
os_bool_t os_systick_is_timeout(os_tick_t start_tick, os_tick_t timeout_ticks) {
volatile os_tick_t end_ticks = g_os_systick_ticks;
return (end_ticks - start_tick) >= timeout_ticks;
}
#endif /*INCLUDED_OS_SYSTICK_H*/ #endif /*INCLUDED_OS_SYSTICK_H*/