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 IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, (Z_DEVICE_EXPORT(node_id);))
212
221#define DEVICE_DT_INST_DEFINE(inst, ...) \
222 DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
223
238#define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
239
255#define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
256
266#define DEVICE_DT_INST_GET(inst) DEVICE_DT_GET(DT_DRV_INST(inst))
267
284#define DEVICE_DT_GET_ANY(compat) \
285 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
286 (DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(compat))), \
287 (NULL))
288
305#define DEVICE_DT_GET_ONE(compat) \
306 COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
307 (DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(compat))), \
308 (ZERO_OR_COMPILE_ERROR(0)))
309
320#define DEVICE_DT_GET_OR_NULL(node_id) \
321 COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(node_id), \
322 (DEVICE_DT_GET(node_id)), (NULL))
323
334#define DEVICE_GET(dev_id) (&DEVICE_NAME_GET(dev_id))
335
350#define DEVICE_DECLARE(dev_id) \
351 static const struct device DEVICE_NAME_GET(dev_id)
352
360#define DEVICE_INIT_DT_GET(node_id) \
361 (&Z_INIT_ENTRY_NAME(DEVICE_DT_NAME_GET(node_id)))
362
370#define DEVICE_INIT_GET(dev_id) (&Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)))
371
389
393 bool initialized : 1;
394};
395
396struct pm_device_base;
397struct pm_device;
398struct pm_device_isr;
399#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
400struct device_dt_metadata;
401#endif
402
403#ifdef CONFIG_DEVICE_DEPS_DYNAMIC
404#define Z_DEVICE_DEPS_CONST
405#else
406#define Z_DEVICE_DEPS_CONST const
407#endif
408
412struct device {
414 const char *name;
416 const void *config;
418 const void *api;
422 void *data;
423#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
432 Z_DEVICE_DEPS_CONST device_handle_t *deps;
433#endif /* CONFIG_DEVICE_DEPS */
434#if defined(CONFIG_PM_DEVICE) || defined(__DOXYGEN__)
439 union {
441 struct pm_device *pm;
443 };
444#endif
445#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
446 const struct device_dt_metadata *dt_meta;
447#endif /* CONFIG_DEVICE_DT_METADATA */
448};
449
458static inline device_handle_t device_handle_get(const struct device *dev)
459{
462
463 /* TODO: If/when devices can be constructed that are not part of the
464 * fixed sequence we'll need another solution.
465 */
466 if (dev != NULL) {
467 ret = 1 + (device_handle_t)(dev - STRUCT_SECTION_START(device));
468 }
469
470 return ret;
471}
472
481static inline const struct device *
483{
485 const struct device *dev = NULL;
486 size_t numdev;
487
489
490 if ((dev_handle > 0) && ((size_t)dev_handle <= numdev)) {
491 dev = &STRUCT_SECTION_START(device)[dev_handle - 1];
492 }
493
494 return dev;
495}
496
497#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
498
517typedef int (*device_visitor_callback_t)(const struct device *dev,
518 void *context);
519
538static inline const device_handle_t *
539device_required_handles_get(const struct device *dev, size_t *count)
540{
541 const device_handle_t *rv = dev->deps;
542
543 if (rv != NULL) {
544 size_t i = 0;
545
546 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
547 (rv[i] != Z_DEVICE_DEPS_SEP)) {
548 ++i;
549 }
550 *count = i;
551 }
552
553 return rv;
554}
555
574static inline const device_handle_t *
575device_injected_handles_get(const struct device *dev, size_t *count)
576{
577 const device_handle_t *rv = dev->deps;
578 size_t region = 0;
579 size_t i = 0;
580
581 if (rv != NULL) {
582 /* Fast forward to injected devices */
583 while (region != 1) {
584 if (*rv == Z_DEVICE_DEPS_SEP) {
585 region++;
586 }
587 rv++;
588 }
589 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
590 (rv[i] != Z_DEVICE_DEPS_SEP)) {
591 ++i;
592 }
593 *count = i;
594 }
595
596 return rv;
597}
598
618static inline const device_handle_t *
619device_supported_handles_get(const struct device *dev, size_t *count)
620{
621 const device_handle_t *rv = dev->deps;
622 size_t region = 0;
623 size_t i = 0;
624
625 if (rv != NULL) {
626 /* Fast forward to supporting devices */
627 while (region != 2) {
628 if (*rv == Z_DEVICE_DEPS_SEP) {
629 region++;
630 }
631 rv++;
632 }
633 /* Count supporting devices.
634 * Trailing NULL's can be injected by gen_device_deps.py due to
635 * CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM
636 */
637 while ((rv[i] != Z_DEVICE_DEPS_ENDS) &&
638 (rv[i] != DEVICE_HANDLE_NULL)) {
639 ++i;
640 }
641 *count = i;
642 }
643
644 return rv;
645}
646
677int device_required_foreach(const struct device *dev,
678 device_visitor_callback_t visitor_cb,
679 void *context);
680
710int device_supported_foreach(const struct device *dev,
711 device_visitor_callback_t visitor_cb,
712 void *context);
713
714#endif /* CONFIG_DEVICE_DEPS */
715
736__syscall const struct device *device_get_binding(const char *name);
737
746size_t z_device_get_all_static(const struct device **devices);
747
764__syscall bool device_is_ready(const struct device *dev);
765
780__syscall int device_init(const struct device *dev);
781
792#define Z_DEVICE_STATE_NAME(dev_id) _CONCAT(__devstate_, dev_id)
793
799#define Z_DEVICE_STATE_DEFINE(dev_id) \
800 static Z_DECL_ALIGN(struct device_state) Z_DEVICE_STATE_NAME(dev_id) \
801 __attribute__((__section__(".z_devstate")))
802
803#if defined(CONFIG_DEVICE_DEPS) || defined(__DOXYGEN__)
804
811#define Z_DEVICE_DEPS_NAME(dev_id) _CONCAT(__devicedeps_, dev_id)
812
818#define Z_DEVICE_EXTRA_DEPS(...) \
819 FOR_EACH_NONEMPTY_TERM(IDENTITY, (,), __VA_ARGS__)
820
822#define Z_DEVICE_DEPS_SECTION \
823 __attribute__((__section__(".__device_deps_pass1")))
824
825#ifdef __cplusplus
826#define Z_DEVICE_DEPS_EXTERN extern
827#else
828#define Z_DEVICE_DEPS_EXTERN
829#endif
830
866#define Z_DEVICE_DEPS_DEFINE(node_id, dev_id, ...) \
867 extern Z_DEVICE_DEPS_CONST device_handle_t Z_DEVICE_DEPS_NAME( \
868 dev_id)[]; \
869 Z_DEVICE_DEPS_CONST Z_DECL_ALIGN(device_handle_t) \
870 Z_DEVICE_DEPS_SECTION Z_DEVICE_DEPS_EXTERN __weak \
871 Z_DEVICE_DEPS_NAME(dev_id)[] = { \
872 COND_CODE_1( \
873 DT_NODE_EXISTS(node_id), \
874 (DT_DEP_ORD(node_id), DT_REQUIRES_DEP_ORDS(node_id)), \
875 (DEVICE_HANDLE_NULL,)) \
876 Z_DEVICE_DEPS_SEP, \
877 Z_DEVICE_EXTRA_DEPS(__VA_ARGS__) \
878 Z_DEVICE_DEPS_SEP, \
879 COND_CODE_1(DT_NODE_EXISTS(node_id), \
880 (DT_SUPPORTS_DEP_ORDS(node_id)), ()) \
881 }
882
883#endif /* CONFIG_DEVICE_DEPS */
884#if defined(CONFIG_DEVICE_DT_METADATA) || defined(__DOXYGEN__)
888struct device_dt_nodelabels {
889 /* @brief number of elements in the nodelabels array */
890 size_t num_nodelabels;
891 /* @brief array of node labels as strings, exactly as they
892 * appear in the final devicetree
893 */
894 const char *nodelabels[];
895};
896
904struct device_dt_metadata {
909 const struct device_dt_nodelabels *nl;
910};
911
930__syscall const struct device *device_get_by_dt_nodelabel(const char *nodelabel);
931
937static inline const struct device_dt_nodelabels *
938device_get_dt_nodelabels(const struct device *dev)
939{
940 if (dev->dt_meta == NULL) {
941 return NULL;
942 }
943 return dev->dt_meta->nl;
944}
945
952#define Z_DEVICE_MAX_NODELABEL_LEN Z_DEVICE_MAX_NAME_LEN
953
958#define Z_DEVICE_DT_METADATA_NAME_GET(dev_id) UTIL_CAT(__dev_dt_meta_, dev_id)
959
964#define Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id) UTIL_CAT(__dev_dt_nodelabels_, dev_id)
965
972#define Z_DEVICE_DT_METADATA_DEFINE(node_id, dev_id) \
973 static const struct device_dt_nodelabels \
974 Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id) = { \
975 .num_nodelabels = DT_NUM_NODELABELS(node_id), \
976 .nodelabels = DT_NODELABEL_STRING_ARRAY(node_id), \
977 }; \
978 \
979 static const struct device_dt_metadata \
980 Z_DEVICE_DT_METADATA_NAME_GET(dev_id) = { \
981 .nl = &Z_DEVICE_DT_NODELABELS_NAME_GET(dev_id), \
982 };
983#endif /* CONFIG_DEVICE_DT_METADATA */
984
992#define Z_DEVICE_INIT_SUB_PRIO(node_id) \
993 COND_CODE_1(DT_NODE_EXISTS(node_id), \
994 (DT_DEP_ORD_STR_SORTABLE(node_id)), (0))
995
1002#define Z_DEVICE_MAX_NAME_LEN 48U
1003
1009#define Z_DEVICE_NAME_CHECK(name) \
1010 BUILD_ASSERT(sizeof(Z_STRINGIFY(name)) <= Z_DEVICE_MAX_NAME_LEN, \
1011 Z_STRINGIFY(name) " too long")
1012
1026#define Z_DEVICE_INIT(name_, pm_, data_, config_, api_, state_, deps_, node_id_, \
1027 dev_id_) \
1028 { \
1029 .name = name_, \
1030 .config = (config_), \
1031 .api = (api_), \
1032 .state = (state_), \
1033 .data = (data_), \
1034 IF_ENABLED(CONFIG_DEVICE_DEPS, (.deps = (deps_),)) \
1035 IF_ENABLED(CONFIG_PM_DEVICE, Z_DEVICE_INIT_PM_BASE(pm_)) \
1036 IF_ENABLED(CONFIG_DEVICE_DT_METADATA, \
1037 (IF_ENABLED(DT_NODE_EXISTS(node_id_), \
1038 (.dt_meta = &Z_DEVICE_DT_METADATA_NAME_GET( \
1039 dev_id_),)))) \
1040 }
1041
1042/*
1043 * Anonymous unions require C11. Some pre-C11 gcc versions have early support for anonymous
1044 * unions but they require these braces when combined with C99 designated initializers. For
1045 * more details see https://docs.zephyrproject.org/latest/develop/languages/cpp/
1046 */
1047#if defined(__STDC_VERSION__) && (__STDC_VERSION__) < 201100
1048# define Z_DEVICE_INIT_PM_BASE(pm_) ({ .pm_base = (pm_),},)
1049#else
1050# define Z_DEVICE_INIT_PM_BASE(pm_) (.pm_base = (pm_),)
1051#endif
1052
1059#define Z_DEVICE_SECTION_NAME(level, prio) \
1060 _CONCAT(INIT_LEVEL_ORD(level), _##prio)
1061
1078#define Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, prio, api, state, \
1079 deps) \
1080 COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \
1081 COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), (const)) \
1082 STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE( \
1083 device, COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (device_mutable), (device)), \
1084 Z_DEVICE_SECTION_NAME(level, prio), DEVICE_NAME_GET(dev_id)) = \
1085 Z_DEVICE_INIT(name, pm, data, config, api, state, deps, node_id, dev_id)
1086
1092#define Z_DEVICE_CHECK_INIT_LEVEL(level) \
1093 COND_CODE_1(Z_INIT_PRE_KERNEL_1_##level, (), \
1094 (COND_CODE_1(Z_INIT_PRE_KERNEL_2_##level, (), \
1095 (COND_CODE_1(Z_INIT_POST_KERNEL_##level, (), \
1096 (ZERO_OR_COMPILE_ERROR(0)))))))
1097
1108#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \
1109 Z_DEVICE_CHECK_INIT_LEVEL(level) \
1110 \
1111 static const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \
1112 level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \
1113 Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \
1114 .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \
1115 (init_fn_)}, \
1116 Z_DEVICE_INIT_ENTRY_DEV(node_id, dev_id), \
1117 }
1118
1119#define Z_DEFER_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_) \
1120 static const Z_DECL_ALIGN(struct init_entry) __used __noasan \
1121 __attribute__((__section__(".z_deferred_init"))) \
1122 Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \
1123 .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \
1124 (init_fn_)}, \
1125 Z_DEVICE_INIT_ENTRY_DEV(node_id, dev_id), \
1126 }
1127
1128/*
1129 * Anonymous unions require C11. Some pre-C11 gcc versions have early support for anonymous
1130 * unions but they require these braces when combined with C99 designated initializers. For
1131 * more details see https://docs.zephyrproject.org/latest/develop/languages/cpp/
1132 */
1133#if defined(__STDC_VERSION__) && (__STDC_VERSION__) < 201100
1134# define Z_DEVICE_INIT_ENTRY_DEV(node_id, dev_id) { Z_DEV_ENTRY_DEV(node_id, dev_id) }
1135#else
1136# define Z_DEVICE_INIT_ENTRY_DEV(node_id, dev_id) Z_DEV_ENTRY_DEV(node_id, dev_id)
1137#endif
1138
1139#define Z_DEV_ENTRY_DEV(node_id, dev_id) \
1140 COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = &DEVICE_NAME_GET(dev_id)
1141
1163#define Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, pm, data, config, \
1164 level, prio, api, state, ...) \
1165 Z_DEVICE_NAME_CHECK(name); \
1166 \
1167 IF_ENABLED(CONFIG_DEVICE_DEPS, \
1168 (Z_DEVICE_DEPS_DEFINE(node_id, dev_id, __VA_ARGS__);)) \
1169 \
1170 IF_ENABLED(CONFIG_DEVICE_DT_METADATA, \
1171 (IF_ENABLED(DT_NODE_EXISTS(node_id), \
1172 (Z_DEVICE_DT_METADATA_DEFINE(node_id, dev_id);))))\
1173 \
1174 Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, \
1175 prio, api, state, Z_DEVICE_DEPS_NAME(dev_id)); \
1176 COND_CODE_1(DEVICE_DT_DEFER(node_id), \
1177 (Z_DEFER_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, \
1178 init_fn)), \
1179 (Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn, \
1180 level, prio)));
1181
1192#define Z_MAYBE_DEVICE_DECLARE_INTERNAL(node_id) \
1193 extern COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), \
1194 (const)) struct device DEVICE_DT_NAME_GET(node_id);
1195
1196DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL)
1197
1198
1199#define Z_DEVICE_API_TYPE(_class) _CONCAT(_class, _driver_api)
1200
1209#define DEVICE_API(_class, _name) const STRUCT_SECTION_ITERABLE(Z_DEVICE_API_TYPE(_class), _name)
1210
1219#define DEVICE_API_GET(_class, _dev) ((const struct Z_DEVICE_API_TYPE(_class) *)_dev->api)
1220
1231#define DEVICE_API_IS(_class, _dev) \
1232 ({ \
1233 STRUCT_SECTION_START_EXTERN(Z_DEVICE_API_TYPE(_class)); \
1234 STRUCT_SECTION_END_EXTERN(Z_DEVICE_API_TYPE(_class)); \
1235 (DEVICE_API_GET(_class, _dev) < STRUCT_SECTION_END(Z_DEVICE_API_TYPE(_class)) && \
1236 DEVICE_API_GET(_class, _dev) >= STRUCT_SECTION_START(Z_DEVICE_API_TYPE(_class))); \
1237 })
1238
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: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:539
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:619
static device_handle_t device_handle_get(const struct device *dev)
Get the handle for a given device.
Definition device.h:458
#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:482
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:517
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:575
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:2949
#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:380
bool initialized
Indicates the device initialization function has been invoked.
Definition device.h:393
uint8_t init_res
Device initialization return code (positive errno value).
Definition device.h:388
Runtime device structure (in ROM) per driver instance.
Definition device.h:412
struct pm_device_base * pm_base
Definition device.h:440
const device_handle_t * deps
Optional pointer to dependencies associated with the device.
Definition device.h:432
struct pm_device_isr * pm_isr
Definition device.h:442
const char * name
Name of the device instance.
Definition device.h:414
struct pm_device * pm
Definition device.h:441
void * data
Address of the device instance private data.
Definition device.h:422
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:418
struct device_state * state
Address of the common device state.
Definition device.h:420
const void * config
Address of device instance config information.
Definition device.h:416
const struct device_dt_metadata * dt_meta
Definition device.h:446
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.