Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
device.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_DEVICE_H_
8#define ZEPHYR_INCLUDE_DEVICE_H_
9
10#include <stdint.h>
11
12#include <zephyr/devicetree.h>
13#include <zephyr/init.h>
15#include <zephyr/pm/state.h>
18#include <zephyr/sys/util.h>
19#include <zephyr/toolchain.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
39#define Z_DEVICE_DEPS_SEP INT16_MIN
40
45#define Z_DEVICE_DEPS_ENDS INT16_MAX
46
48#define Z_DEVICE_IS_MUTABLE(node_id) \
49 COND_CODE_1(IS_ENABLED(CONFIG_DEVICE_MUTABLE), (DT_PROP(node_id, zephyr_mutable)), (0))
50
69
71#define DEVICE_HANDLE_NULL 0
72
92#define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
93
94/* Node paths can exceed the maximum size supported by
95 * device_get_binding() in user mode; this macro synthesizes a unique
96 * dev_id from a devicetree node while staying within this maximum
97 * size.
98 *
99 * The ordinal used in this name can be mapped to the path by
100 * examining zephyr/include/generated/zephyr/devicetree_generated.h.
101 */
102#define Z_DEVICE_DT_DEV_ID(node_id) _CONCAT(dts_ord_, DT_DEP_ORD(node_id))
103
134#define DEVICE_DEFINE(dev_id, name, init_fn, pm, data, config, level, prio, \
135 api) \
136 Z_DEVICE_STATE_DEFINE(dev_id); \
137 Z_DEVICE_DEFINE(DT_INVALID_NODE, dev_id, name, init_fn, pm, data, \
138 config, level, prio, api, \
139 &Z_DEVICE_STATE_NAME(dev_id))
140
152#define DEVICE_DT_NAME(node_id) \
153 DT_PROP_OR(node_id, label, DT_NODE_FULL_NAME(node_id))
154
162#define DEVICE_DT_DEFER(node_id) \
163 DT_PROP(node_id, zephyr_deferred_init)
164
195#define DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, prio, api, \
196 ...) \
197 Z_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \
198 Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
199 DEVICE_DT_NAME(node_id), init_fn, pm, data, config, \
200 level, prio, api, \
201 &Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \
202 __VA_ARGS__)
203
212#define DEVICE_DT_INST_DEFINE(inst, ...) \
213 DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
214
229#define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
230
246#define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
247
257#define DEVICE_DT_INST_GET(inst) DEVICE_DT_GET(DT_DRV_INST(inst))
258
275#define DEVICE_DT_GET_ANY(compat) \
276 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
277 (DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(compat))), \
278 (NULL))
279
296#define DEVICE_DT_GET_ONE(compat) \
297 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
298 (DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(compat))), \
299 (ZERO_OR_COMPILE_ERROR(0)))
300
311#define DEVICE_DT_GET_OR_NULL(node_id) \
312 COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), \
313 (DEVICE_DT_GET(node_id)), (NULL))
314
325#define DEVICE_GET(dev_id) (&DEVICE_NAME_GET(dev_id))
326
341#define DEVICE_DECLARE(dev_id) \
342 static const struct device DEVICE_NAME_GET(dev_id)
343
351#define DEVICE_INIT_DT_GET(node_id) \
352 (&Z_INIT_ENTRY_NAME(DEVICE_DT_NAME_GET(node_id)))
353
361#define DEVICE_INIT_GET(dev_id) (&Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)))
362
380
384 bool initialized : 1;
385};
386
387struct pm_device_base;
388struct pm_device;
389struct pm_device_isr;
390#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
391struct device_dt_metadata;
392#endif
393
394#ifdef CONFIG_DEVICE_DEPS_DYNAMIC
395#define Z_DEVICE_DEPS_CONST
396#else
397#define Z_DEVICE_DEPS_CONST const
398#endif
399
403struct device {
405 const char *name;
407 const void *config;
409 const void *api;
413 void *data;
414#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
423 Z_DEVICE_DEPS_CONST device_handle_t *deps;
424#endif /* CONFIG_DEVICE_DEPS */
425#if defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) || defined(__DOXYGEN__)
428#endif /* CONFIG_PM */
429#if defined(CONFIG_PM_DEVICE) || defined(__DOXYGEN__)
434 union {
436 struct pm_device *pm;
438 };
439#endif
440#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
441 const struct device_dt_metadata *dt_meta;
442#endif /* CONFIG_DEVICE_DT_METADATA */
443};
444
453static inline device_handle_t device_handle_get(const struct device *dev)
454{
457
458 /* TODO: If/when devices can be constructed that are not part of the
459 * fixed sequence we'll need another solution.
460 */
461 if (dev != NULL) {
462 ret = 1 + (device_handle_t)(dev - STRUCT_SECTION_START(device));
463 }
464
465 return ret;
466}
467
476static inline const struct device *
478{
480 const struct device *dev = NULL;
481 size_t numdev;
482
484
485 if ((dev_handle > 0) && ((size_t)dev_handle <= numdev)) {
486 dev = &STRUCT_SECTION_START(device)[dev_handle - 1];
487 }
488
489 return dev;
490}
491
492#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
493
512typedef int (*device_visitor_callback_t)(const struct device *dev,
513 void *context);
514
533static inline const device_handle_t *
534device_required_handles_get(const struct device *dev, size_t *count)
535{
536 const device_handle_t *rv = dev->deps;
537
538 if (rv != NULL) {
539 size_t i = 0;
540
541 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
542 (rv[i] != Z_DEVICE_DEPS_SEP)) {
543 ++i;
544 }
545 *count = i;
546 }
547
548 return rv;
549}
550
569static inline const device_handle_t *
570device_injected_handles_get(const struct device *dev, size_t *count)
571{
572 const device_handle_t *rv = dev->deps;
573 size_t region = 0;
574 size_t i = 0;
575
576 if (rv != NULL) {
577 /* Fast forward to injected devices */
578 while (region != 1) {
579 if (*rv == Z_DEVICE_DEPS_SEP) {
580 region++;
581 }
582 rv++;
583 }
584 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
585 (rv[i] != Z_DEVICE_DEPS_SEP)) {
586 ++i;
587 }
588 *count = i;
589 }
590
591 return rv;
592}
593
613static inline const device_handle_t *
614device_supported_handles_get(const struct device *dev, size_t *count)
615{
616 const device_handle_t *rv = dev->deps;
617 size_t region = 0;
618 size_t i = 0;
619
620 if (rv != NULL) {
621 /* Fast forward to supporting devices */
622 while (region != 2) {
623 if (*rv == Z_DEVICE_DEPS_SEP) {
624 region++;
625 }
626 rv++;
627 }
628 /* Count supporting devices.
629 * Trailing NULL's can be injected by gen_device_deps.py due to
630 * CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM
631 */
632 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
633 (rv[i] != DEVICE_HANDLE_NULL)) {
634 ++i;
635 }
636 *count = i;
637 }
638
639 return rv;
640}
641
672int device_required_foreach(const struct device *dev,
673 device_visitor_callback_t visitor_cb,
674 void *context);
675
705int device_supported_foreach(const struct device *dev,
706 device_visitor_callback_t visitor_cb,
707 void *context);
708
709#endif /* CONFIG_DEVICE_DEPS */
710
731__syscall const struct device *device_get_binding(const char *name);
732
741size_t z_device_get_all_static(const struct device **devices);
742
759__syscall bool device_is_ready(const struct device *dev);
760
775__syscall int device_init(const struct device *dev);
776
787#define Z_DEVICE_STATE_NAME(dev_id) _CONCAT(__devstate_, dev_id)
788
794#define Z_DEVICE_STATE_DEFINE(dev_id) \
795 static Z_DECL_ALIGN(struct device_state) Z_DEVICE_STATE_NAME(dev_id) \
796 __attribute__((__section__(".z_devstate")))
797
798#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
799
806#define Z_DEVICE_DEPS_NAME(dev_id) _CONCAT(__devicedeps_, dev_id)
807
813#define Z_DEVICE_EXTRA_DEPS(...) \
814 FOR_EACH_NONEMPTY_TERM(IDENTITY, (,), __VA_ARGS__)
815
817#define Z_DEVICE_DEPS_SECTION \
818 __attribute__((__section__(".__device_deps_pass1")))
819
820#ifdef __cplusplus
821#define Z_DEVICE_DEPS_EXTERN extern
822#else
823#define Z_DEVICE_DEPS_EXTERN
824#endif
825
861#define Z_DEVICE_DEPS_DEFINE(node_id, dev_id, ...) \
862 extern Z_DEVICE_DEPS_CONST device_handle_t Z_DEVICE_DEPS_NAME( \
863 dev_id)[]; \
864 Z_DEVICE_DEPS_CONST Z_DECL_ALIGN(device_handle_t) \
865 Z_DEVICE_DEPS_SECTION Z_DEVICE_DEPS_EXTERN __weak \
866 Z_DEVICE_DEPS_NAME(dev_id)[] = { \
867 COND_CODE_1( \
868 DT_NODE_EXISTS(node_id), \
869 (DT_DEP_ORD(node_id), DT_REQUIRES_DEP_ORDS(node_id)), \
870 (DEVICE_HANDLE_NULL,)) \
871 Z_DEVICE_DEPS_SEP, \
872 Z_DEVICE_EXTRA_DEPS(__VA_ARGS__) \
873 Z_DEVICE_DEPS_SEP, \
874 COND_CODE_1(DT_NODE_EXISTS(node_id), \
875 (DT_SUPPORTS_DEP_ORDS(node_id)), ()) \
876 }
877
878#endif /* CONFIG_DEVICE_DEPS */
879
880#if defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) || defined(__DOXYGEN__)
881
887#define Z_DEVICE_PM_CONSTRAINTS_NAME(dev_id) _CONCAT(__devicepmconstraints_, dev_id)
888
894#define Z_PM_STATE_CONSTRAINT_DT_INIT(node_id) \
895 { \
896 .state = PM_STATE_DT_INIT(node_id), \
897 .substate_id = DT_PROP_OR(node_id, substate_id, 0), \
898 }
899
900#define Z_PM_STATE_FROM_DT_DEVICE(i, node_id) \
901 COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, \
902 zephyr_disabling_power_states, i), okay), \
903 (Z_PM_STATE_CONSTRAINT_DT_INIT(DT_PHANDLE_BY_IDX(node_id, \
904 zephyr_disabling_power_states, i)),), ())
905
909#define Z_PM_STATE_CONSTRAINTS_FROM_DT_DEVICE(node_id) \
910 { \
911 LISTIFY(DT_PROP_LEN_OR(node_id, zephyr_disabling_power_states, 0), \
912 Z_PM_STATE_FROM_DT_DEVICE, (), node_id) \
913 }
914
925#define Z_DEVICE_PM_CONSTRAINTS_DEFINE(node_id, dev_id, ...) \
926 Z_DECL_ALIGN(struct pm_state_constraint) \
927 Z_DEVICE_PM_CONSTRAINTS_NAME(dev_id)[] = \
928 Z_PM_STATE_CONSTRAINTS_FROM_DT_DEVICE(node_id);
929
930#endif /* CONFIG_PM_POLICY_DEVICE_CONSTRAINTS */
931
932#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
936struct device_dt_nodelabels {
937 /* @brief number of elements in the nodelabels array */
938 size_t num_nodelabels;
939 /* @brief array of node labels as strings, exactly as they
940 * appear in the final devicetree
941 */
942 const char *nodelabels[];
943};
944
952struct device_dt_metadata {
957 const struct device_dt_nodelabels *nl;
958};
959
978__syscall const struct device *device_get_by_dt_nodelabel(const char *nodelabel);
979
985static inline const struct device_dt_nodelabels *
986device_get_dt_nodelabels(const struct device *dev)
987{
988 return dev->dt_meta->nl;
989}
990
997#define Z_DEVICE_MAX_NODELABEL_LEN Z_DEVICE_MAX_NAME_LEN
998
1003#define Z_DEVICE_DT_METADATA_NAME_GET(dev_id) UTIL_CAT(__dev_dt_meta_, dev_id)
1004
1009#define Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id) UTIL_CAT(__dev_dt_nodelabels_, dev_id)
1010
1017#define Z_DEVICE_DT_METADATA_DEFINE(node_id, dev_id) \
1018 static const struct device_dt_nodelabels \
1019 Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id) = { \
1020 .num_nodelabels = DT_NUM_NODELABELS(node_id), \
1021 .nodelabels = DT_NODELABEL_STRING_ARRAY(node_id), \
1022 }; \
1023 \
1024 static const struct device_dt_metadata \
1025 Z_DEVICE_DT_METADATA_NAME_GET(dev_id) = { \
1026 .nl = &Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id), \
1027 };
1028#endif /* CONFIG_DEVICE_DT_METADATA */
1029
1037#define Z_DEVICE_INIT_SUB_PRIO(node_id) \
1038 COND_CODE_1(DT_NODE_EXISTS(node_id), \
1039 (DT_DEP_ORD_STR_SORTABLE(node_id)), (0))
1040
1047#define Z_DEVICE_MAX_NAME_LEN 48U
1048
1054#define Z_DEVICE_NAME_CHECK(name) \
1055 BUILD_ASSERT(sizeof(Z_STRINGIFY(name)) <= Z_DEVICE_MAX_NAME_LEN, \
1056 Z_STRINGIFY(DEVICE_NAME_GET(name)) " too long")
1057
1070#define Z_DEVICE_INIT(name_, pm_, data_, config_, api_, state_, deps_, \
1071 constraints_size_, constraints_, dev_id_) \
1072 { \
1073 .name = name_, \
1074 .config = (config_), \
1075 .api = (api_), \
1076 .state = (state_), \
1077 .data = (data_), \
1078 IF_ENABLED(CONFIG_DEVICE_DEPS, (.deps = (deps_),)) \
1079 IF_ENABLED(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS, \
1080 (.pm_constraints = (constraints_),)) \
1081 IF_ENABLED(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS, \
1082 (.pm_constraints_size = (constraints_size_),)) \
1083 IF_ENABLED(CONFIG_PM_DEVICE, ({ .pm_base = (pm_),})) \
1084 IF_ENABLED(CONFIG_DEVICE_DT_METADATA, \
1085 (.dt_meta = &Z_DEVICE_DT_METADATA_NAME_GET(dev_id_),)) \
1086 }
1087
1094#define Z_DEVICE_SECTION_NAME(level, prio) \
1095 _CONCAT(INIT_LEVEL_ORD(level), _##prio)
1096
1113#define Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, prio, api, state, \
1114 deps, constraints) \
1115 COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \
1116 COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), (const)) \
1117 STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE( \
1118 device, COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (device_mutable), (device)), \
1119 Z_DEVICE_SECTION_NAME(level, prio), DEVICE_NAME_GET(dev_id)) = \
1120 Z_DEVICE_INIT(name, pm, data, config, api, state, deps, \
1121 DT_PROP_LEN_OR(node_id, zephyr_disabling_power_states, 0), constraints, dev_id)
1122
1123/* deprecated device initialization levels */
1124#define Z_DEVICE_LEVEL_DEPRECATED_EARLY \
1125 __WARN("EARLY device driver level is deprecated")
1126#define Z_DEVICE_LEVEL_DEPRECATED_PRE_KERNEL_1
1127#define Z_DEVICE_LEVEL_DEPRECATED_PRE_KERNEL_2
1128#define Z_DEVICE_LEVEL_DEPRECATED_POST_KERNEL
1129#define Z_DEVICE_LEVEL_DEPRECATED_APPLICATION \
1130 __WARN("APPLICATION device driver level is deprecated")
1131#define Z_DEVICE_LEVEL_DEPRECATED_SMP \
1132 __WARN("SMP device driver level is deprecated")
1133
1139#define Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \
1140 Z_DEVICE_LEVEL_DEPRECATED_##level
1141
1152#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \
1153 Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \
1154 \
1155 static const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \
1156 level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \
1157 Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \
1158 .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \
1159 (init_fn_)}, \
1160 { \
1161 COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \
1162 &DEVICE_NAME_GET(dev_id), \
1163 }, \
1164 }
1165
1166#define Z_DEFER_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_) \
1167 static const Z_DECL_ALIGN(struct init_entry) __used __noasan \
1168 __attribute__((__section__(".z_deferred_init"))) \
1169 Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \
1170 .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \
1171 (init_fn_)}, \
1172 { \
1173 COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \
1174 &DEVICE_NAME_GET(dev_id), \
1175 }, \
1176 }
1177
1199#define Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, pm, data, config, \
1200 level, prio, api, state, ...) \
1201 Z_DEVICE_NAME_CHECK(name); \
1202 \
1203 IF_ENABLED(CONFIG_DEVICE_DEPS, \
1204 (Z_DEVICE_DEPS_DEFINE(node_id, dev_id, __VA_ARGS__);)) \
1205 \
1206 IF_ENABLED(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS, \
1207 (Z_DEVICE_PM_CONSTRAINTS_DEFINE(node_id, dev_id, __VA_ARGS__);))\
1208 \
1209 IF_ENABLED(CONFIG_DEVICE_DT_METADATA, \
1210 (Z_DEVICE_DT_METADATA_DEFINE(node_id, dev_id);)) \
1211 \
1212 Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, \
1213 prio, api, state, Z_DEVICE_DEPS_NAME(dev_id), \
1214 Z_DEVICE_PM_CONSTRAINTS_NAME(dev_id)); \
1215 COND_CODE_1(DEVICE_DT_DEFER(node_id), \
1216 (Z_DEFER_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, \
1217 init_fn)), \
1218 (Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn, \
1219 level, prio)));
1220
1231#define Z_MAYBE_DEVICE_DECLARE_INTERNAL(node_id) \
1232 extern COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), \
1233 (const)) struct device DEVICE_DT_NAME_GET(node_id);
1234
1235DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL)
1236
1237
1239#ifdef __cplusplus
1240}
1241#endif
1242
1243#include <zephyr/syscalls/device.h>
1244
1245#endif /* ZEPHYR_INCLUDE_DEVICE_H_ */
Devicetree main header.
const struct device * device_get_binding(const char *name)
Get a device reference from its device::name field.
int16_t device_handle_t
Type used to represent a "handle" for a device.
Definition: device.h:68
static const device_handle_t * device_required_handles_get(const struct device *dev, size_t *count)
Get the device handles for devicetree dependencies of this device.
Definition: device.h:534
static const device_handle_t * device_supported_handles_get(const struct device *dev, size_t *count)
Get the set of handles that this device supports.
Definition: device.h:614
static device_handle_t device_handle_get(const struct device *dev)
Get the handle for a given device.
Definition: device.h:453
#define DEVICE_HANDLE_NULL
Flag value used to identify an unknown device.
Definition: device.h:71
int device_required_foreach(const struct device *dev, device_visitor_callback_t visitor_cb, void *context)
Visit every device that dev directly requires.
static const struct device * device_from_handle(device_handle_t dev_handle)
Get the device corresponding to a handle.
Definition: device.h:477
int(* device_visitor_callback_t)(const struct device *dev, void *context)
Prototype for functions used when iterating over a set of devices.
Definition: device.h:512
bool device_is_ready(const struct device *dev)
Verify that a device is ready for use.
static const device_handle_t * device_injected_handles_get(const struct device *dev, size_t *count)
Get the device handles for injected dependencies of this device.
Definition: device.h:570
int device_init(const struct device *dev)
Initialize a device.
int device_supported_foreach(const struct device *dev, device_visitor_callback_t visitor_cb, void *context)
Visit every device that dev directly supports.
#define DT_FOREACH_STATUS_OKAY_NODE(fn)
Invokes fn for every status okay node in the tree.
Definition: devicetree.h:2785
#define STRUCT_SECTION_START_EXTERN(struct_type)
iterable section extern for start symbol for a struct
Definition: iterable_sections.h:159
#define STRUCT_SECTION_START(struct_type)
iterable section start symbol for a struct type
Definition: iterable_sections.h:149
#define STRUCT_SECTION_COUNT(struct_type, dst)
Count elements in a section.
Definition: iterable_sections.h:291
Definitions of various linker Sections.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__INT16_TYPE__ int16_t
Definition: stdint.h:73
Runtime device dynamic structure (in RAM) per driver instance.
Definition: device.h:371
bool initialized
Indicates the device initialization function has been invoked.
Definition: device.h:384
uint8_t init_res
Device initialization return code (positive errno value).
Definition: device.h:379
Runtime device structure (in ROM) per driver instance.
Definition: device.h:403
struct pm_device_base * pm_base
Definition: device.h:435
const device_handle_t * deps
Optional pointer to dependencies associated with the device.
Definition: device.h:423
struct pm_device_isr * pm_isr
Definition: device.h:437
const char * name
Name of the device instance.
Definition: device.h:405
struct pm_device * pm
Definition: device.h:436
void * data
Address of the device instance private data.
Definition: device.h:413
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:409
struct pm_state_constraint const * pm_constraints
Definition: device.h:426
size_t pm_constraints_size
Definition: device.h:427
struct device_state * state
Address of the common device state.
Definition: device.h:411
const void * config
Address of device instance config information.
Definition: device.h:407
const struct device_dt_metadata * dt_meta
Definition: device.h:441
Device PM info.
Definition: device.h:139
Runtime PM info for device with synchronous PM.
Definition: device.h:185
Runtime PM info for device with generic PM.
Definition: device.h:163
Power state information needed to lock a power state.
Definition: state.h:172
Macros to abstract toolchain specific capabilities.
Misc utilities.