Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
coredump.h
Go to the documentation of this file.
1/*
2 * Copyright Meta Platforms, Inc. and its affiliates.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef INCLUDE_ZEPHYR_DRIVERS_COREDUMP_H_
13#define INCLUDE_ZEPHYR_DRIVERS_COREDUMP_H_
14
15#include <zephyr/device.h>
16#include <zephyr/sys/slist.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
47
55typedef void (*coredump_dump_callback_t)(uintptr_t dump_area, size_t dump_area_size);
56
63/*
64 * Type definition of coredump API function for adding specified
65 * data into coredump
66 */
67typedef void (*coredump_device_dump_t)(const struct device *dev);
68
69/*
70 * Type definition of coredump API function for registering a memory
71 * region
72 */
73typedef bool (*coredump_device_register_memory_t)(const struct device *dev,
74 struct coredump_mem_region_node *region);
75
76/*
77 * Type definition of coredump API function for unregistering a memory
78 * region
79 */
80typedef bool (*coredump_device_unregister_memory_t)(const struct device *dev,
81 struct coredump_mem_region_node *region);
82
83/*
84 * Type definition of coredump API function for registering a dump
85 * callback
86 */
87typedef bool (*coredump_device_register_callback_t)(const struct device *dev,
89
90/*
91 * API which a coredump pseudo-device driver should expose
92 */
93__subsystem struct coredump_driver_api {
94 coredump_device_dump_t dump;
95 coredump_device_register_memory_t register_memory;
96 coredump_device_unregister_memory_t unregister_memory;
97 coredump_device_register_callback_t register_callback;
98};
99
114static inline bool coredump_device_register_memory(const struct device *dev,
115 struct coredump_mem_region_node *region)
116{
117 const struct coredump_driver_api *api =
118 (const struct coredump_driver_api *)dev->api;
119
120 return api->register_memory(dev, region);
121}
122
133static inline bool coredump_device_unregister_memory(const struct device *dev,
134 struct coredump_mem_region_node *region)
135{
136 const struct coredump_driver_api *api =
137 (const struct coredump_driver_api *)dev->api;
138
139 return api->unregister_memory(dev, region);
140}
141
151static inline bool coredump_device_register_callback(const struct device *dev,
153{
154 const struct coredump_driver_api *api =
155 (const struct coredump_driver_api *)dev->api;
156
157 return api->register_callback(dev, callback);
158}
159
164#ifdef __cplusplus
165}
166#endif
167
168#endif /* INCLUDE_ZEPHYR_DRIVERS_COREDUMP_H_ */
static bool coredump_device_register_memory(const struct device *dev, struct coredump_mem_region_node *region)
Register a region of memory to be stored in core dump at the time it is generated.
Definition coredump.h:114
void(* coredump_dump_callback_t)(uintptr_t dump_area, size_t dump_area_size)
Callback that occurs at dump time, data copied into dump_area will be included in the dump that is ge...
Definition coredump.h:55
static bool coredump_device_register_callback(const struct device *dev, coredump_dump_callback_t callback)
Register a callback to be invoked at dump time.
Definition coredump.h:151
static bool coredump_device_unregister_memory(const struct device *dev, struct coredump_mem_region_node *region)
Unregister a region of memory to be stored in core dump at the time it is generated.
Definition coredump.h:133
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
#define bool
Definition stdbool.h:13
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
Structure describing a region in memory that may be stored in core dump at the time it is generated.
Definition coredump.h:37
sys_snode_t node
Node of single-linked list, do not modify.
Definition coredump.h:39
size_t size
Size of memory region.
Definition coredump.h:45
uintptr_t start
Address of start of memory region.
Definition coredump.h:42
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:409