Zephyr API Documentation
4.2.0-rc3
A Scalable Open Source RTOS
4.2.0-rc3
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
init.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Intel Corporation.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_INIT_H_
8
#define ZEPHYR_INCLUDE_INIT_H_
9
10
#include <
stdint.h
>
11
#include <stddef.h>
12
13
#include <
zephyr/sys/util.h
>
14
#include <
zephyr/toolchain.h
>
15
16
#include <
zephyr/service.h
>
17
18
#ifdef __cplusplus
19
extern
"C"
{
20
#endif
21
51
52
struct
device
;
53
68
struct
init_entry
{
73
union
{
74
const
void
*_init_object;
75
const
struct
device
*
dev
;
76
const
struct
service
*
srv
;
77
};
78
};
68
struct
init_entry
{
…
};
79
81
82
/* Helper definitions to evaluate level equality */
83
#define Z_INIT_EARLY_EARLY 1
84
#define Z_INIT_PRE_KERNEL_1_PRE_KERNEL_1 1
85
#define Z_INIT_PRE_KERNEL_2_PRE_KERNEL_2 1
86
#define Z_INIT_POST_KERNEL_POST_KERNEL 1
87
#define Z_INIT_APPLICATION_APPLICATION 1
88
#define Z_INIT_SMP_SMP 1
89
90
/* Init level ordinals */
91
#define Z_INIT_ORD_EARLY 0
92
#define Z_INIT_ORD_PRE_KERNEL_1 1
93
#define Z_INIT_ORD_PRE_KERNEL_2 2
94
#define Z_INIT_ORD_POST_KERNEL 3
95
#define Z_INIT_ORD_APPLICATION 4
96
#define Z_INIT_ORD_SMP 5
97
103
#define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
104
112
#define Z_INIT_ENTRY_SECTION(level, prio, sub_prio) \
113
__attribute__((__section__( \
114
".z_init_" #level "_P_" STRINGIFY(prio) "_SUB_" STRINGIFY(sub_prio)"_")))
115
117
126
#define INIT_LEVEL_ORD(level) \
127
COND_CODE_1(Z_INIT_EARLY_##level, (Z_INIT_ORD_EARLY), \
128
(COND_CODE_1(Z_INIT_PRE_KERNEL_1_##level, (Z_INIT_ORD_PRE_KERNEL_1), \
129
(COND_CODE_1(Z_INIT_PRE_KERNEL_2_##level, (Z_INIT_ORD_PRE_KERNEL_2), \
130
(COND_CODE_1(Z_INIT_POST_KERNEL_##level, (Z_INIT_ORD_POST_KERNEL), \
131
(COND_CODE_1(Z_INIT_APPLICATION_##level, (Z_INIT_ORD_APPLICATION), \
132
(COND_CODE_1(Z_INIT_SMP_##level, (Z_INIT_ORD_SMP), \
133
(ZERO_OR_COMPILE_ERROR(0)))))))))))))
126
#define INIT_LEVEL_ORD(level) \
…
134
151
#define SYS_INIT(init_fn, level, prio) \
152
SYS_INIT_NAMED(init_fn, init_fn, level, prio)
151
#define SYS_INIT(init_fn, level, prio) \
…
153
167
#define SYS_INIT_NAMED(name, init_fn_, level, prio) \
168
Z_SERVICE_DEFINE(name, init_fn_, level, prio); \
169
static const Z_DECL_ALIGN(struct init_entry) \
170
Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \
171
Z_INIT_ENTRY_NAME(name) = { \
172
.srv = (const struct service *)&Z_SERVICE_NAME_GET(name) \
173
}
167
#define SYS_INIT_NAMED(name, init_fn_, level, prio) \
…
174
176
177
#ifdef __cplusplus
178
}
179
#endif
180
181
#endif
/* ZEPHYR_INCLUDE_INIT_H_ */
service.h
stdint.h
device
Runtime device structure (in ROM) per driver instance.
Definition
device.h:510
init_entry
Structure to store initialization entry information.
Definition
init.h:68
init_entry::srv
const struct service * srv
Definition
init.h:76
init_entry::dev
const struct device * dev
Definition
init.h:75
service
Structure to store service instance.
Definition
service.h:31
util.h
Misc utilities.
toolchain.h
Macros to abstract toolchain specific capabilities.
zephyr
init.h
Generated on
for Zephyr API Documentation by
1.14.0