Zephyr API Documentation 4.0.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 CONFIG_LLEXT
22#include <zephyr/llext/symbol.h>
23#endif
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
43#define Z_DEVICE_DEPS_SEP INT16_MIN
44
49#define Z_DEVICE_DEPS_ENDS INT16_MAX
50
52#define Z_DEVICE_IS_MUTABLE(node_id) \
53 COND_CODE_1(IS_ENABLED(CONFIG_DEVICE_MUTABLE), (DT_PROP(node_id, zephyr_mutable)), (0))
54
73
75#define DEVICE_HANDLE_NULL 0
76
96#define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
97
98/* This macro synthesizes a unique dev_id from a devicetree node by using
99 * the node's dependency ordinal.
100 *
101 * The ordinal used in this name can be mapped to the path by
102 * examining zephyr/include/generated/zephyr/devicetree_generated.h.
103 */
104#define Z_DEVICE_DT_DEV_ID(node_id) _CONCAT(dts_ord_, DT_DEP_ORD(node_id))
105
106#if defined(CONFIG_LLEXT_EXPORT_DEVICES)
107/* Export device identifiers using the builtin name */
108#define Z_DEVICE_EXPORT(node_id) EXPORT_SYMBOL(DEVICE_DT_NAME_GET(node_id))
109#endif
110
141#define DEVICE_DEFINE(dev_id, name, init_fn, pm, data, config, level, prio, \
142 api) \
143 Z_DEVICE_STATE_DEFINE(dev_id); \
144 Z_DEVICE_DEFINE(DT_INVALID_NODE, dev_id, name, init_fn, pm, data, \
145 config, level, prio, api, \
146 &Z_DEVICE_STATE_NAME(dev_id))
147
159#define DEVICE_DT_NAME(node_id) \
160 DT_PROP_OR(node_id, label, DT_NODE_FULL_NAME(node_id))
161
169#define DEVICE_DT_DEFER(node_id) \
170 DT_PROP(node_id, zephyr_deferred_init)
171
203#define DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, prio, api, \
204 ...) \
205 Z_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \
206 Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
207 DEVICE_DT_NAME(node_id), init_fn, pm, data, config, \
208 level, prio, api, \
209 &Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \
210 __VA_ARGS__)
211
220#define DEVICE_DT_INST_DEFINE(inst, ...) \
221 DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
222
237#define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
238
254#define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
255
265#define DEVICE_DT_INST_GET(inst) DEVICE_DT_GET(DT_DRV_INST(inst))
266
283#define DEVICE_DT_GET_ANY(compat) \
284 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
285 (DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(compat))), \
286 (NULL))
287
304#define DEVICE_DT_GET_ONE(compat) \
305 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
306 (DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(compat))), \
307 (ZERO_OR_COMPILE_ERROR(0)))
308
319#define DEVICE_DT_GET_OR_NULL(node_id) \
320 COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(node_id), \
321 (DEVICE_DT_GET(node_id)), (NULL))
322
333#define DEVICE_GET(dev_id) (&DEVICE_NAME_GET(dev_id))
334
349#define DEVICE_DECLARE(dev_id) \
350 static const struct device DEVICE_NAME_GET(dev_id)
351
359#define DEVICE_INIT_DT_GET(node_id) \
360 (&Z_INIT_ENTRY_NAME(DEVICE_DT_NAME_GET(node_id)))
361
369#define DEVICE_INIT_GET(dev_id) (&Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)))
370
388
392 bool initialized : 1;
393};
394
395struct pm_device_base;
396struct pm_device;
397struct pm_device_isr;
398#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
399struct device_dt_metadata;
400#endif
401
402#ifdef CONFIG_DEVICE_DEPS_DYNAMIC
403#define Z_DEVICE_DEPS_CONST
404#else
405#define Z_DEVICE_DEPS_CONST const
406#endif
407
411struct device {
413 const char *name;
415 const void *config;
417 const void *api;
421 void *data;
422#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
431 Z_DEVICE_DEPS_CONST device_handle_t *deps;
432#endif /* CONFIG_DEVICE_DEPS */
433#if defined(CONFIG_PM_DEVICE) || defined(__DOXYGEN__)
438 union {
440 struct pm_device *pm;
442 };
443#endif
444#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
445 const struct device_dt_metadata *dt_meta;
446#endif /* CONFIG_DEVICE_DT_METADATA */
447};
448
457static inline device_handle_t device_handle_get(const struct device *dev)
458{
461
462 /* TODO: If/when devices can be constructed that are not part of the
463 * fixed sequence we'll need another solution.
464 */
465 if (dev != NULL) {
466 ret = 1 + (device_handle_t)(dev - STRUCT_SECTION_START(device));
467 }
468
469 return ret;
470}
471
480static inline const struct device *
482{
484 const struct device *dev = NULL;
485 size_t numdev;
486
488
489 if ((dev_handle > 0) && ((size_t)dev_handle <= numdev)) {
490 dev = &STRUCT_SECTION_START(device)[dev_handle - 1];
491 }
492
493 return dev;
494}
495
496#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
497
516typedef int (*device_visitor_callback_t)(const struct device *dev,
517 void *context);
518
537static inline const device_handle_t *
538device_required_handles_get(const struct device *dev, size_t *count)
539{
540 const device_handle_t *rv = dev->deps;
541
542 if (rv != NULL) {
543 size_t i = 0;
544
545 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
546 (rv[i] != Z_DEVICE_DEPS_SEP)) {
547 ++i;
548 }
549 *count = i;
550 }
551
552 return rv;
553}
554
573static inline const device_handle_t *
574device_injected_handles_get(const struct device *dev, size_t *count)
575{
576 const device_handle_t *rv = dev->deps;
577 size_t region = 0;
578 size_t i = 0;
579
580 if (rv != NULL) {
581 /* Fast forward to injected devices */
582 while (region != 1) {
583 if (*rv == Z_DEVICE_DEPS_SEP) {
584 region++;
585 }
586 rv++;
587 }
588 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
589 (rv[i] != Z_DEVICE_DEPS_SEP)) {
590 ++i;
591 }
592 *count = i;
593 }
594
595 return rv;
596}
597
617static inline const device_handle_t *
618device_supported_handles_get(const struct device *dev, size_t *count)
619{
620 const device_handle_t *rv = dev->deps;
621 size_t region = 0;
622 size_t i = 0;
623
624 if (rv != NULL) {
625 /* Fast forward to supporting devices */
626 while (region != 2) {
627 if (*rv == Z_DEVICE_DEPS_SEP) {
628 region++;
629 }
630 rv++;
631 }
632 /* Count supporting devices.
633 * Trailing NULL's can be injected by gen_device_deps.py due to
634 * CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM
635 */
636 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
637 (rv[i] != DEVICE_HANDLE_NULL)) {
638 ++i;
639 }
640 *count = i;
641 }
642
643 return rv;
644}
645
676int device_required_foreach(const struct device *dev,
677 device_visitor_callback_t visitor_cb,
678 void *context);
679
709int device_supported_foreach(const struct device *dev,
710 device_visitor_callback_t visitor_cb,
711 void *context);
712
713#endif /* CONFIG_DEVICE_DEPS */
714
735__syscall const struct device *device_get_binding(const char *name);
736
745size_t z_device_get_all_static(const struct device **devices);
746
763__syscall bool device_is_ready(const struct device *dev);
764
779__syscall int device_init(const struct device *dev);
780
791#define Z_DEVICE_STATE_NAME(dev_id) _CONCAT(__devstate_, dev_id)
792
798#define Z_DEVICE_STATE_DEFINE(dev_id) \
799 static Z_DECL_ALIGN(struct device_state) Z_DEVICE_STATE_NAME(dev_id) \
800 __attribute__((__section__(".z_devstate")))
801
802#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
803
810#define Z_DEVICE_DEPS_NAME(dev_id) _CONCAT(__devicedeps_, dev_id)
811
817#define Z_DEVICE_EXTRA_DEPS(...) \
818 FOR_EACH_NONEMPTY_TERM(IDENTITY, (,), __VA_ARGS__)
819
821#define Z_DEVICE_DEPS_SECTION \
822 __attribute__((__section__(".__device_deps_pass1")))
823
824#ifdef __cplusplus
825#define Z_DEVICE_DEPS_EXTERN extern
826#else
827#define Z_DEVICE_DEPS_EXTERN
828#endif
829
865#define Z_DEVICE_DEPS_DEFINE(node_id, dev_id, ...) \
866 extern Z_DEVICE_DEPS_CONST device_handle_t Z_DEVICE_DEPS_NAME( \
867 dev_id)[]; \
868 Z_DEVICE_DEPS_CONST Z_DECL_ALIGN(device_handle_t) \
869 Z_DEVICE_DEPS_SECTION Z_DEVICE_DEPS_EXTERN __weak \
870 Z_DEVICE_DEPS_NAME(dev_id)[] = { \
871 COND_CODE_1( \
872 DT_NODE_EXISTS(node_id), \
873 (DT_DEP_ORD(node_id), DT_REQUIRES_DEP_ORDS(node_id)), \
874 (DEVICE_HANDLE_NULL,)) \
875 Z_DEVICE_DEPS_SEP, \
876 Z_DEVICE_EXTRA_DEPS(__VA_ARGS__) \
877 Z_DEVICE_DEPS_SEP, \
878 COND_CODE_1(DT_NODE_EXISTS(node_id), \
879 (DT_SUPPORTS_DEP_ORDS(node_id)), ()) \
880 }
881
882#endif /* CONFIG_DEVICE_DEPS */
883#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
887struct device_dt_nodelabels {
888 /* @brief number of elements in the nodelabels array */
889 size_t num_nodelabels;
890 /* @brief array of node labels as strings, exactly as they
891 * appear in the final devicetree
892 */
893 const char *nodelabels[];
894};
895
903struct device_dt_metadata {
908 const struct device_dt_nodelabels *nl;
909};
910
929__syscall const struct device *device_get_by_dt_nodelabel(const char *nodelabel);
930
936static inline const struct device_dt_nodelabels *
937device_get_dt_nodelabels(const struct device *dev)
938{
939 if (dev->dt_meta == NULL) {
940 return NULL;
941 }
942 return dev->dt_meta->nl;
943}
944
951#define Z_DEVICE_MAX_NODELABEL_LEN Z_DEVICE_MAX_NAME_LEN
952
957#define Z_DEVICE_DT_METADATA_NAME_GET(dev_id) UTIL_CAT(__dev_dt_meta_, dev_id)
958
963#define Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id) UTIL_CAT(__dev_dt_nodelabels_, dev_id)
964
971#define Z_DEVICE_DT_METADATA_DEFINE(node_id, dev_id) \
972 static const struct device_dt_nodelabels \
973 Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id) = { \
974 .num_nodelabels = DT_NUM_NODELABELS(node_id), \
975 .nodelabels = DT_NODELABEL_STRING_ARRAY(node_id), \
976 }; \
977 \
978 static const struct device_dt_metadata \
979 Z_DEVICE_DT_METADATA_NAME_GET(dev_id) = { \
980 .nl = &Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id), \
981 };
982#endif /* CONFIG_DEVICE_DT_METADATA */
983
991#define Z_DEVICE_INIT_SUB_PRIO(node_id) \
992 COND_CODE_1(DT_NODE_EXISTS(node_id), \
993 (DT_DEP_ORD_STR_SORTABLE(node_id)), (0))
994
1001#define Z_DEVICE_MAX_NAME_LEN 48U
1002
1008#define Z_DEVICE_NAME_CHECK(name) \
1009 BUILD_ASSERT(sizeof(Z_STRINGIFY(name)) <= Z_DEVICE_MAX_NAME_LEN, \
1010 Z_STRINGIFY(name) " too long")
1011
1025#define Z_DEVICE_INIT(name_, pm_, data_, config_, api_, state_, deps_, node_id_, \
1026 dev_id_) \
1027 { \
1028 .name = name_, \
1029 .config = (config_), \
1030 .api = (api_), \
1031 .state = (state_), \
1032 .data = (data_), \
1033 IF_ENABLED(CONFIG_DEVICE_DEPS, (.deps = (deps_),)) \
1034 IF_ENABLED(CONFIG_PM_DEVICE, Z_DEVICE_INIT_PM_BASE(pm_)) \
1035 IF_ENABLED(CONFIG_DEVICE_DT_METADATA, \
1036 (IF_ENABLED(DT_NODE_EXISTS(node_id_), \
1037 (.dt_meta = &Z_DEVICE_DT_METADATA_NAME_GET( \
1038 dev_id_),)))) \
1039 }
1040
1041/*
1042 * Anonymous unions require C11. Some pre-C11 gcc versions have early support for anonymous
1043 * unions but they require these braces when combined with C99 designated initializers. For
1044 * more details see https://docs.zephyrproject.org/latest/develop/languages/cpp/
1045 */
1046#if defined(__STDC_VERSION__) && (__STDC_VERSION__) < 201100
1047# define Z_DEVICE_INIT_PM_BASE(pm_) ({ .pm_base = (pm_),},)
1048#else
1049# define Z_DEVICE_INIT_PM_BASE(pm_) (.pm_base = (pm_),)
1050#endif
1051
1058#define Z_DEVICE_SECTION_NAME(level, prio) \
1059 _CONCAT(INIT_LEVEL_ORD(level), _##prio)
1060
1077#define Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, prio, api, state, \
1078 deps) \
1079 COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \
1080 COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), (const)) \
1081 STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE( \
1082 device, COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (device_mutable), (device)), \
1083 Z_DEVICE_SECTION_NAME(level, prio), DEVICE_NAME_GET(dev_id)) = \
1084 Z_DEVICE_INIT(name, pm, data, config, api, state, deps, node_id, dev_id)
1085
1091#define Z_DEVICE_CHECK_INIT_LEVEL(level) \
1092 COND_CODE_1(Z_INIT_PRE_KERNEL_1_##level, (), \
1093 (COND_CODE_1(Z_INIT_PRE_KERNEL_2_##level, (), \
1094 (COND_CODE_1(Z_INIT_POST_KERNEL_##level, (), \
1095 (ZERO_OR_COMPILE_ERROR(0)))))))
1096
1107#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \
1108 Z_DEVICE_CHECK_INIT_LEVEL(level) \
1109 \
1110 static const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \
1111 level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \
1112 Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \
1113 .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \
1114 (init_fn_)}, \
1115 Z_DEVICE_INIT_ENTRY_DEV(node_id, dev_id), \
1116 }
1117
1118#define Z_DEFER_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_) \
1119 static const Z_DECL_ALIGN(struct init_entry) __used __noasan \
1120 __attribute__((__section__(".z_deferred_init"))) \
1121 Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \
1122 .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \
1123 (init_fn_)}, \
1124 Z_DEVICE_INIT_ENTRY_DEV(node_id, dev_id), \
1125 }
1126
1127/*
1128 * Anonymous unions require C11. Some pre-C11 gcc versions have early support for anonymous
1129 * unions but they require these braces when combined with C99 designated initializers. For
1130 * more details see https://docs.zephyrproject.org/latest/develop/languages/cpp/
1131 */
1132#if defined(__STDC_VERSION__) && (__STDC_VERSION__) < 201100
1133# define Z_DEVICE_INIT_ENTRY_DEV(node_id, dev_id) { Z_DEV_ENTRY_DEV(node_id, dev_id) }
1134#else
1135# define Z_DEVICE_INIT_ENTRY_DEV(node_id, dev_id) Z_DEV_ENTRY_DEV(node_id, dev_id)
1136#endif
1137
1138#define Z_DEV_ENTRY_DEV(node_id, dev_id) \
1139 COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = &DEVICE_NAME_GET(dev_id)
1140
1162#define Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, pm, data, config, \
1163 level, prio, api, state, ...) \
1164 Z_DEVICE_NAME_CHECK(name); \
1165 \
1166 IF_ENABLED(CONFIG_DEVICE_DEPS, \
1167 (Z_DEVICE_DEPS_DEFINE(node_id, dev_id, __VA_ARGS__);)) \
1168 \
1169 IF_ENABLED(CONFIG_DEVICE_DT_METADATA, \
1170 (IF_ENABLED(DT_NODE_EXISTS(node_id), \
1171 (Z_DEVICE_DT_METADATA_DEFINE(node_id, dev_id);))))\
1172 \
1173 Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, \
1174 prio, api, state, Z_DEVICE_DEPS_NAME(dev_id)); \
1175 COND_CODE_1(DEVICE_DT_DEFER(node_id), \
1176 (Z_DEFER_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, \
1177 init_fn)), \
1178 (Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn, \
1179 level, prio))); \
1180 IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, \
1181 (IF_ENABLED(DT_NODE_EXISTS(node_id), \
1182 (Z_DEVICE_EXPORT(node_id);))))
1183
1194#define Z_MAYBE_DEVICE_DECLARE_INTERNAL(node_id) \
1195 extern COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), \
1196 (const)) struct device DEVICE_DT_NAME_GET(node_id);
1197
1198DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL)
1199
1200
1201#define Z_DEVICE_API_TYPE(_class) _CONCAT(_class, _driver_api)
1202
1211#define DEVICE_API(_class, _name) const STRUCT_SECTION_ITERABLE(Z_DEVICE_API_TYPE(_class), _name)
1212
1221#define DEVICE_API_GET(_class, _dev) ((const struct Z_DEVICE_API_TYPE(_class) *)_dev->api)
1222
1233#define DEVICE_API_IS(_class, _dev) \
1234 ({ \
1235 STRUCT_SECTION_START_EXTERN(Z_DEVICE_API_TYPE(_class)); \
1236 STRUCT_SECTION_END_EXTERN(Z_DEVICE_API_TYPE(_class)); \
1237 (DEVICE_API_GET(_class, _dev) < STRUCT_SECTION_END(Z_DEVICE_API_TYPE(_class)) && \
1238 DEVICE_API_GET(_class, _dev) >= STRUCT_SECTION_START(Z_DEVICE_API_TYPE(_class))); \
1239 })
1240
1241#ifdef __cplusplus
1242}
1243#endif
1244
1245#include <zephyr/syscalls/device.h>
1246
1247#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:72
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:538
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:618
static device_handle_t device_handle_get(const struct device *dev)
Get the handle for a given device.
Definition device.h:457
#define DEVICE_HANDLE_NULL
Flag value used to identify an unknown device.
Definition device.h:75
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:481
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:516
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:574
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:2960
#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:379
bool initialized
Indicates the device initialization function has been invoked.
Definition device.h:392
uint8_t init_res
Device initialization return code (positive errno value).
Definition device.h:387
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
struct pm_device_base * pm_base
Definition device.h:439
const device_handle_t * deps
Optional pointer to dependencies associated with the device.
Definition device.h:431
struct pm_device_isr * pm_isr
Definition device.h:441
const char * name
Name of the device instance.
Definition device.h:413
struct pm_device * pm
Definition device.h:440
void * data
Address of the device instance private data.
Definition device.h:421
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:417
struct device_state * state
Address of the common device state.
Definition device.h:419
const void * config
Address of device instance config information.
Definition device.h:415
const struct device_dt_metadata * dt_meta
Definition device.h:445
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
Linkable loadable extension symbol definitions.
Misc utilities.
Macros to abstract toolchain specific capabilities.