Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
system_timer.h File Reference

Timer driver API. More...

#include <stdbool.h>
#include <zephyr/types.h>
#include <zephyr/spinlock.h>

Go to the source code of this file.

Macros

#define SYS_CLOCK_MAX_WAIT   (UINT32_MAX / 2)
#define SYS_CLOCK_IDLE_FOREVER   UINT32_MAX
 Tick count meaning "nothing needs to wake the CPU up".

Functions

k_spinlock_key_t sys_clock_lock (void)
 Lock the system clock.
void sys_clock_unlock (k_spinlock_key_t key)
 Unlock the system clock.
void sys_clock_set_timeout (uint32_t ticks, bool idle)
 Set system clock timeout.
void sys_clock_idle_exit (void)
 Timer idle exit notification.
void sys_clock_announce_locked (uint32_t ticks, k_spinlock_key_t key)
 Announce time progress to the kernel.
static void sys_clock_announce (uint32_t ticks)
 Announce time progress to the kernel (legacy wrapper).
uint32_t sys_clock_elapsed (void)
 Ticks elapsed since last sys_clock_announce() call.
void sys_clock_disable (void)
 Disable system timer.
void sys_clock_no_timeout (void)
 Notify the timer driver that no timeout is pending.
void sys_clock_idle_enter (uint32_t ticks)
 Notify the timer driver that the CPU is entering low-power idle.
uint32_t sys_clock_cycle_get_32 (void)
 Hardware cycle counter.
uint64_t sys_clock_cycle_get_64 (void)
 64 bit hardware cycle counter

Detailed Description

Timer driver API.

Declare API implemented by system timer driver and used by kernel components.

Macro Definition Documentation

◆ SYS_CLOCK_IDLE_FOREVER

#define SYS_CLOCK_IDLE_FOREVER   UINT32_MAX

Tick count meaning "nothing needs to wake the CPU up".

Passed to sys_clock_idle_enter() when no wakeup is expected. It is above SYS_CLOCK_MAX_WAIT, the longest wait the kernel ever asks for, so it cannot be taken for one. K_TICKS_FOREVER is not usable here: it is (int64_t)-1 with CONFIG_TIMEOUT_64BIT and UINT32_MAX without it, so comparing an unsigned tick count against it means different things in the two configurations.

◆ SYS_CLOCK_MAX_WAIT

#define SYS_CLOCK_MAX_WAIT   (UINT32_MAX / 2)