Zephyr API Documentation 4.2.0-rc3
A Scalable Open Source RTOS
|
|
4.2.0-rc3 |
Zephyr offers an infrastructure to call initialization code before main. More...
Data Structures | |
struct | init_entry |
Structure to store initialization entry information. More... |
Macros | |
#define | INIT_LEVEL_ORD(level) |
Obtain the ordinal for an init level. | |
#define | SYS_INIT(init_fn, level, prio) |
Register an initialization function. | |
#define | SYS_INIT_NAMED(name, init_fn_, level, prio) |
Register an initialization function (named). |
Zephyr offers an infrastructure to call initialization code before main.
Such initialization calls can be registered using SYS_INIT() or SYS_INIT_NAMED() macros. By using a combination of initialization levels and priorities init sequence can be adjusted as needed. The available initialization levels are described, in order, below:
CONFIG_SMP
is enabled, specific for SMP.Initialization priority can take a value in the range of 0 to 999.
#define INIT_LEVEL_ORD | ( | level | ) |
#include <zephyr/init.h>
Obtain the ordinal for an init level.
level | Init level (EARLY, PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL, APPLICATION, SMP). |
#define SYS_INIT | ( | init_fn, | |
level, | |||
prio ) |
#include <zephyr/init.h>
Register an initialization function.
The function will be called during system initialization according to the given level and priority.
init_fn | Initialization function. |
level | Initialization level. Allowed tokens: EARLY, PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL, APPLICATION and SMP if CONFIG_SMP is enabled. |
prio | Initialization priority within _level . Note that it 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). |
#define SYS_INIT_NAMED | ( | name, | |
init_fn_, | |||
level, | |||
prio ) |
#include <zephyr/init.h>
Register an initialization function (named).
name | Unique name for SYS_INIT entry. |
init_fn_ | See SYS_INIT(). |
level | See SYS_INIT(). |
prio | See SYS_INIT(). |