Zephyr Project API  3.2.0
A Scalable Open Source RTOS
Device Model

Device Model. More...

Modules

 Device Model APIs
 Device Model APIs.
 
 Device memory-mapped IO management
 

Macros

#define SYS_INIT(_init_fn, _level, _prio)    SYS_INIT_NAMED(_init_fn, _init_fn, _level, _prio)
 Run an initialization function at boot at specified priority. More...
 
#define SYS_INIT_NAMED(_name, _init_fn, _level, _prio)    Z_INIT_ENTRY_DEFINE(Z_SYS_NAME(_name), _init_fn, NULL, _level, _prio)
 Run an initialization function at boot at specified priority. More...
 

Detailed Description

Device Model.

Macro Definition Documentation

◆ SYS_INIT

#define SYS_INIT (   _init_fn,
  _level,
  _prio 
)     SYS_INIT_NAMED(_init_fn, _init_fn, _level, _prio)

#include <include/zephyr/init.h>

Run an initialization function at boot at specified priority.

This macro lets you run a function at system boot.

Parameters
_init_fnPointer to the boot function to run
_levelThe initialization level at which configuration occurs. Must be one of the following symbols, which are listed in the order they are performed by the kernel:
  • PRE_KERNEL_1: Used for initialization objects that have no dependencies, such as those that rely solely on hardware present in the processor/SOC. These objects cannot use any kernel services during configuration, since they are not yet available.
  • PRE_KERNEL_2: Used for initialization objects that rely on objects initialized as part of the PRE_KERNEL_1 level. These objects cannot use any kernel services during configuration, since they are not yet available.
  • POST_KERNEL: Used for initialization objects that require kernel services during configuration.
  • POST_KERNEL_SMP: Used for initialization objects that require kernel services during configuration after SMP initialization.
  • APPLICATION: Used for application components (i.e. non-kernel components) that need automatic configuration. These objects can use all services provided by the kernel during configuration.
_prioThe initialization priority of the object, relative to other objects of the same initialization level. Specified as an integer value in the range 0 to 99; lower values indicate earlier initialization. Must be a decimal integer literal without leading zeroes or sign (e.g. 32), or an equivalent symbolic name (e.g. #define MY_INIT_PRIO 32); symbolic expressions are not permitted (e.g. CONFIG_KERNEL_INIT_PRIORITY_DEFAULT + 5).

◆ SYS_INIT_NAMED

#define SYS_INIT_NAMED (   _name,
  _init_fn,
  _level,
  _prio 
)     Z_INIT_ENTRY_DEFINE(Z_SYS_NAME(_name), _init_fn, NULL, _level, _prio)

#include <include/zephyr/init.h>

Run an initialization function at boot at specified priority.

This macro lets you run a function at system boot.

Parameters
_nameUnique name for SYS_INIT entry. Allows specifying multiple init entries that utilise the same function.
_init_fnSee SYS_INIT
_levelSee SYS_INIT
_prioSee SYS_INIT