Zephyr API 3.6.99
Loading...
Searching...
No Matches
log_internal.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_INTERNAL_H_
7#define ZEPHYR_INCLUDE_LOGGING_LOG_INTERNAL_H_
8
9#include <zephyr/types.h>
10#include <zephyr/sys/__assert.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/* Header contains declarations of functions used internally in the logging,
19 * shared between various portions of logging subsystem. Functions are internal
20 * not intended to be used outside, including logging backends.
21 */
22
27
31};
32
39void z_log_dropped(bool buffered);
40
45uint32_t z_log_dropped_read_and_clear(void);
46
52bool z_log_dropped_pending(void);
53
58void z_log_free(void *buf);
59
60/* Initialize runtime filters */
61void z_log_runtime_filters_init(void);
62
63/* Initialize links. */
64void z_log_links_initiate(void);
65
66/* Activate links.
67 * Attempt to activate links,
68 *
69 * @param active_mask Mask with links to activate. N bit set indicates that Nth
70 * link should be activated.
71 *
72 * @param[in, out] offset Offset assigned to domains. Initialize to 0 before first use.
73 *
74 * @return Mask with links that still remain inactive.
75 */
76uint32_t z_log_links_activate(uint32_t active_mask, uint8_t *offset);
77
78/* Notify log_core that a backend was enabled. */
79void z_log_notify_backend_enabled(void);
80
87static inline uint32_t *z_log_dynamic_filters_get(uint32_t source_id)
88{
89 return &TYPE_SECTION_START(log_dynamic)[source_id].filters;
90}
91
93static inline uint32_t z_log_sources_count(void)
94{
95 return log_const_source_id(TYPE_SECTION_END(log_const));
96}
97
102uint8_t z_log_ext_domain_count(void);
103
105void z_log_msg_init(void);
106
111void z_log_msg_commit(struct log_msg *msg);
112
118union log_msg_generic *z_log_msg_claim(k_timeout_t *backoff);
119
124void z_log_msg_free(union log_msg_generic *msg);
125
131bool z_log_msg_pending(void);
132
133static inline void z_log_notify_drop(const struct mpsc_pbuf_buffer *buffer,
134 const union mpsc_pbuf_generic *item)
135{
136 ARG_UNUSED(buffer);
137 ARG_UNUSED(item);
138
139 z_log_dropped(true);
140}
141
146const char *z_log_get_tag(void);
147
154static inline bool z_log_is_local_domain(uint8_t domain_id)
155{
156 return !IS_ENABLED(CONFIG_LOG_MULTIDOMAIN) ||
157 (domain_id == Z_LOG_LOCAL_DOMAIN_ID);
158}
159
164log_timestamp_t z_log_timestamp(void);
165
166#ifdef __cplusplus
167}
168#endif
169
170#endif /* ZEPHYR_INCLUDE_LOGGING_LOG_INTERNAL_H_ */
#define TYPE_SECTION_END(secname)
iterable section end symbol for a generic type
Definition iterable_sections.h:65
#define TYPE_SECTION_START(secname)
iterable section start symbol for a generic type
Definition iterable_sections.h:55
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:124
static uint32_t log_const_source_id(const struct log_source_const_data *data)
Get index of the log source based on the address of the constant data associated with the source.
Definition log_core.h:464
uint32_t log_timestamp_t
Definition log_msg.h:36
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Kernel timeout type.
Definition sys_clock.h:65
Structure wrapper to be used for memory section.
Definition log_internal.h:24
struct mpsc_pbuf_buffer buf
Definition log_internal.h:25
Structure wrapper to be used for memory section.
Definition log_internal.h:29
union log_msg_generic * msg
Definition log_internal.h:30
Definition log_msg.h:94
MPSC packet buffer structure.
Definition mpsc_pbuf.h:90
Definition log_msg.h:117
union mpsc_pbuf_generic buf
Definition log_msg.h:118
Generic packet header.
Definition mpsc_packet.h:49