Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
CPU Idling APIs

Functions

static void k_cpu_idle (void)
 Make the CPU idle.
 
static void k_cpu_atomic_idle (unsigned int key)
 Make the CPU idle in an atomic fashion.
 

Detailed Description

Function Documentation

◆ k_cpu_atomic_idle()

static void k_cpu_atomic_idle ( unsigned int key)
inlinestatic

#include <zephyr/kernel.h>

Make the CPU idle in an atomic fashion.

Similar to k_cpu_idle(), but must be called with interrupts locked.

Enabling interrupts and entering a low-power mode will be atomic, i.e. there will be no period of time where interrupts are enabled before the processor enters a low-power mode.

After waking up from the low-power mode, the interrupt lockout state will be restored as if by irq_unlock(key).

Parameters
keyInterrupt locking key obtained from irq_lock().

◆ k_cpu_idle()

static void k_cpu_idle ( void )
inlinestatic

#include <zephyr/kernel.h>

Make the CPU idle.

This function makes the CPU idle until an event wakes it up.

In a regular system, the idle thread should be the only thread responsible for making the CPU idle and triggering any type of power management. However, in some more constrained systems, such as a single-threaded system, the only thread would be responsible for this if needed.

Note
In some architectures, before returning, the function unmasks interrupts unconditionally.