Skip to content

Commit a9baa0f

Browse files
committed
supervisor: tick: document
1 parent 7071959 commit a9baa0f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

supervisor/shared/tick.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,32 @@
2929

3030
#include <stdint.h>
3131

32+
/** @brief To be called once every ms
33+
*
34+
* The port must call supervisor_tick once per millisecond to perform regular tasks.
35+
* This is called from the SysTick interrupt or similar, and is safe to call in an
36+
* interrupt context.
37+
*/
3238
extern void supervisor_tick(void);
39+
/** @brief Get the lower 32 bits of the time in milliseconds
40+
*
41+
* This can be more efficient than supervisor_ticks_ms64, for sites where a wraparound
42+
* of ~49.5 days is not harmful.
43+
*/
3344
extern uint32_t supervisor_ticks_ms32(void);
45+
/** @brief Get the full time in milliseconds
46+
*
47+
* Because common ARM mcus cannot atomically work with 64-bit quantities, this
48+
* function must briefly disable interrupts in order to return the value. If
49+
* only relative durations of less than about ~49.5 days need to be considered,
50+
* then it may be possible to use supervisor_ticks_ms64 instead.
51+
*/
3452
extern uint64_t supervisor_ticks_ms64(void);
53+
/** @brief Run background ticks, but only about every millisecond.
54+
*
55+
* Normally, this is not called directly. Instead use the RUN_BACKGROUND_TASKS
56+
* macro.
57+
*/
3558
extern void supervisor_run_background_if_tick(void);
3659

3760
#endif

0 commit comments

Comments
 (0)