Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
smp.h File Reference
#include <stdbool.h>

Go to the source code of this file.

Typedefs

typedef void(* smp_init_fn) (void *arg)
 

Functions

void k_smp_cpu_start (int id, smp_init_fn fn, void *arg)
 Start a CPU.
 
void k_smp_cpu_resume (int id, smp_init_fn fn, void *arg, bool reinit_timer, bool invoke_sched)
 Resume a previously suspended CPU.
 

Typedef Documentation

◆ smp_init_fn

typedef void(* smp_init_fn) (void *arg)

Function Documentation

◆ k_smp_cpu_resume()

void k_smp_cpu_resume ( int id,
smp_init_fn fn,
void * arg,
bool reinit_timer,
bool invoke_sched )

Resume a previously suspended CPU.

This function works like k_smp_cpu_start, but does not re-initialize the kernel's internal tracking data for the target CPU. Therefore, k_smp_cpu_start must have previously been called for the target CPU, and it must have verifiably reached an idle/off state (detection of which must be provided by the platform layers). It may be used in cases where platform layers require, for example, that data on the interrupt or idle stack be preserved.

Note
This function must not be used on currently running CPU. The target CPU must be in suspended state, or in certain architectural state(s) where the CPU is permitted to go through the resume process. Detection of such state(s) must be provided by the platform layers.
Parameters
idID of target CPU.
fnFunction to be called before resuming context.
argArgument to fn.
reinit_timerTrue if timer needs to be re-initialized.
invoke_schedTrue if scheduler is invoked after the CPU has started.

◆ k_smp_cpu_start()

void k_smp_cpu_start ( int id,
smp_init_fn fn,
void * arg )

Start a CPU.

This routine is used to manually start the CPU specified by id. It may be called to restart a CPU that had been stopped or powered down, as well as some other scenario. After the CPU has finished initialization, the CPU will be ready to participate in thread scheduling and execution.

Note
This function must not be used on currently running CPU. The target CPU must be in off state, or in certain architectural state(s) where the CPU is permitted to go through the power up process. Detection of such state(s) must be provided by the platform layers.
This initializes per-CPU kernel structs and also initializes timers needed for MP operations. Use k_smp_cpu_resume if these are not desired.
Parameters
idID of target CPU.
fnFunction to be called before letting scheduler run.
argArgument to fn.