Zephyr API Documentation
4.2.00-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
service.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 Tomasz Bursztyka.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_SERVICE_H_
8
#define ZEPHYR_INCLUDE_SERVICE_H_
9
10
#include <
zephyr/sys/iterable_sections.h
>
11
12
#ifdef __cplusplus
13
extern
"C"
{
14
#endif
15
31
struct
service
{
35
int (*
init
)(void);
36
};
37
48
#define Z_SERVICE_NAME_GET(name) _CONCAT(__service_, name)
49
55
#define Z_SERVICE_INIT(init_fn) \
56
{ \
57
.init = (init_fn) \
58
}
59
66
#define Z_SERVICE_SECTION_NAME(level, prio) \
67
_CONCAT(INIT_LEVEL_ORD(level), _##prio)
68
77
#define Z_SERVICE_DEFINE(name, init_fn, level, prio) \
78
static const \
79
STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE( \
80
service, service, \
81
Z_SERVICE_SECTION_NAME(level, prio), \
82
Z_SERVICE_NAME_GET(name)) = Z_SERVICE_INIT(init_fn)
83
88
#ifdef __cplusplus
89
}
90
#endif
91
92
#endif
/* ZEPHYR_INCLUDE_SERVICE_H_ */
service
Structure to store service instance.
Definition
service.h:31
service::init
int(* init)(void)
Initialization function.
Definition
service.h:35
iterable_sections.h
zephyr
service.h
Generated on Sat Jun 28 2025 01:37:40 for Zephyr API Documentation by
1.12.0