Zephyr API Documentation
3.6.0
A Scalable Open Source RTOS
3.6.0
Toggle main menu visibility
Main Page
Related Pages
Modules
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
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
#ifdef __cplusplus
17
extern
"C"
{
18
#endif
19
50
struct
device
;
51
59
union
init_function
{
66
int (*
sys
)(void);
75
int (*
dev
)(
const
struct
device
*
dev
);
76
#ifdef CONFIG_DEVICE_MUTABLE
85
int (*dev_rw)(
struct
device
*
dev
);
86
#endif
87
};
88
103
struct
init_entry
{
105
union
init_function
init_fn
;
110
union
{
111
const
struct
device
*
dev
;
112
#ifdef CONFIG_DEVICE_MUTABLE
113
struct
device
*dev_rw;
114
#endif
115
};
116
};
117
120
/* Helper definitions to evaluate level equality */
121
#define Z_INIT_EARLY_EARLY 1
122
#define Z_INIT_PRE_KERNEL_1_PRE_KERNEL_1 1
123
#define Z_INIT_PRE_KERNEL_2_PRE_KERNEL_2 1
124
#define Z_INIT_POST_KERNEL_POST_KERNEL 1
125
#define Z_INIT_APPLICATION_APPLICATION 1
126
#define Z_INIT_SMP_SMP 1
127
128
/* Init level ordinals */
129
#define Z_INIT_ORD_EARLY 0
130
#define Z_INIT_ORD_PRE_KERNEL_1 1
131
#define Z_INIT_ORD_PRE_KERNEL_2 2
132
#define Z_INIT_ORD_POST_KERNEL 3
133
#define Z_INIT_ORD_APPLICATION 4
134
#define Z_INIT_ORD_SMP 5
135
141
#define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
142
150
#define Z_INIT_ENTRY_SECTION(level, prio, sub_prio) \
151
__attribute__((__section__( \
152
".z_init_"
#level STRINGIFY(prio)"_" STRINGIFY(sub_prio)"_")))
153
164
#define INIT_LEVEL_ORD(level) \
165
COND_CODE_1(Z_INIT_EARLY_##level, (Z_INIT_ORD_EARLY), \
166
(COND_CODE_1(Z_INIT_PRE_KERNEL_1_##level, (Z_INIT_ORD_PRE_KERNEL_1), \
167
(COND_CODE_1(Z_INIT_PRE_KERNEL_2_##level, (Z_INIT_ORD_PRE_KERNEL_2), \
168
(COND_CODE_1(Z_INIT_POST_KERNEL_##level, (Z_INIT_ORD_POST_KERNEL), \
169
(COND_CODE_1(Z_INIT_APPLICATION_##level, (Z_INIT_ORD_APPLICATION), \
170
(COND_CODE_1(Z_INIT_SMP_##level, (Z_INIT_ORD_SMP), \
171
(ZERO_OR_COMPILE_ERROR(0)))))))))))))
172
189
#define SYS_INIT(init_fn, level, prio) \
190
SYS_INIT_NAMED(init_fn, init_fn, level, prio)
191
205
#define SYS_INIT_NAMED(name, init_fn_, level, prio) \
206
static const Z_DECL_ALIGN(struct init_entry) \
207
Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \
208
Z_INIT_ENTRY_NAME(name) = {{ (init_fn_) }, { NULL } }
209
212
#ifdef __cplusplus
213
}
214
#endif
215
216
#endif
/* ZEPHYR_INCLUDE_INIT_H_ */
stdint.h
device
Runtime device structure (in ROM) per driver instance.
Definition:
device.h:387
init_entry
Structure to store initialization entry information.
Definition:
init.h:103
init_entry::init_fn
union init_function init_fn
Initialization function.
Definition:
init.h:105
init_entry::dev
const struct device * dev
Definition:
init.h:111
toolchain.h
Macros to abstract toolchain specific capabilities.
init_function
Initialization function for init entries.
Definition:
init.h:59
init_function::dev
int(* dev)(const struct device *dev)
Device initialization function.
Definition:
init.h:75
init_function::sys
int(* sys)(void)
System initialization function.
Definition:
init.h:66
util.h
Misc utilities.
zephyr
init.h
Generated on Sat Feb 24 2024 03:45:05 for Zephyr API Documentation by
1.9.6