Module timer

Module timer 

Source
Expand description

Kernel timer module.

This module provides the kernel timer functionality, which is responsible for managing the system timer and scheduling tasks based on time intervals.

Structsยง

KernelTimer
SoftwareTimer
Software timer structure

Constantsยง

TICK_INTERVAL_US

Staticsยง

KERNEL_TIMER ๐Ÿ”’
SOFTWARE_TIMER_HEAP ๐Ÿ”’
TICK_COUNT ๐Ÿ”’
TIMER_ACTIVE_FLAGS ๐Ÿ”’
TIMER_ID_COUNTER ๐Ÿ”’

Traitsยง

TimerHandler
Trait for timer expiration callback

Functionsยง

add_timer
Add a new software timer. Returns timer id.
cancel_timer
Cancel a timer by id (O(1) operation - just marks as inactive)
check_software_timers ๐Ÿ”’
Call this from tick() to check and fire expired timers
get_kernel_timer
get_tick
Get the current tick count (monotonic, since boot)
get_time_ns
get_time_us
is_timer_active ๐Ÿ”’
Check if a timer is active (used by check_software_timers)
ms_to_ticks
Convert milliseconds to ticks
ns_to_ticks
Convert nanoseconds to ticks
tick
Increment the global tick counter. Call this from the timer interrupt handler.
ticks_to_ms
Convert ticks to milliseconds
ticks_to_ns
Convert ticks to nanoseconds
ticks_to_us
Convert ticks to microseconds
us_to_ticks
Convert microseconds to ticks