Zephyr Project API 4.4.99
A Scalable Open Source RTOS
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
11
12#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_INTERNAL_H_
13#define ZEPHYR_INCLUDE_LOGGING_LOG_INTERNAL_H_
14
15#include <zephyr/types.h>
16#include <zephyr/sys/__assert.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/* Header contains declarations of functions used internally in the logging,
25 * shared between various portions of logging subsystem. Functions are internal
26 * not intended to be used outside, including logging backends.
27 */
28
30
32struct log_mpsc_pbuf {
33 struct mpsc_pbuf_buffer buf;
34};
35
37struct log_msg_ptr {
38 union log_msg_generic *msg;
39};
40
47void z_log_dropped(bool buffered);
48
53uint32_t z_log_dropped_read_and_clear(void);
54
60bool z_log_dropped_pending(void);
61
66void z_log_free(void *buf);
67
68/* Initialize runtime filters */
69void z_log_runtime_filters_init(void);
70
71/* Initialize links. */
72void z_log_links_initiate(void);
73
74/* Activate links.
75 * Attempt to activate links,
76 *
77 * @param active_mask Mask with links to activate. N bit set indicates that Nth
78 * link should be activated.
79 *
80 * @param[in, out] offset Offset assigned to domains. Initialize to 0 before first use.
81 *
82 * @return Mask with links that still remain inactive.
83 */
84uint32_t z_log_links_activate(uint32_t active_mask, uint8_t *offset);
85
86/* Notify log_core that a backend was enabled. */
87void z_log_notify_backend_enabled(void);
88
95static inline uint32_t *z_log_dynamic_filters_get(uint32_t source_id)
96{
97 return &TYPE_SECTION_START(log_dynamic)[source_id].filters;
98}
99
101static inline uint32_t z_log_sources_count(void)
102{
103 return log_const_source_id(TYPE_SECTION_END(log_const));
104}
105
110uint8_t z_log_ext_domain_count(void);
111
113void z_log_msg_init(void);
114
119void z_log_msg_commit(struct log_msg *msg);
120
126union log_msg_generic *z_log_msg_claim(k_timeout_t *backoff);
127
132void z_log_msg_free(union log_msg_generic *msg);
133
139bool z_log_msg_pending(void);
140
141static inline void z_log_notify_drop(const struct mpsc_pbuf_buffer *buffer,
142 const union mpsc_pbuf_generic *item)
143{
144 ARG_UNUSED(buffer);
145 ARG_UNUSED(item);
146
147 z_log_dropped(true);
148}
149
154const char *z_log_get_tag(void);
155
162static inline bool z_log_is_local_domain(uint8_t domain_id)
163{
164 return !IS_ENABLED(CONFIG_LOG_MULTIDOMAIN) ||
165 (domain_id == Z_LOG_LOCAL_DOMAIN_ID);
166}
167
172log_timestamp_t z_log_timestamp(void);
173
175
176#ifdef __cplusplus
177}
178#endif
179
180#endif /* ZEPHYR_INCLUDE_LOGGING_LOG_INTERNAL_H_ */
#define TYPE_SECTION_END(secname)
iterable section end symbol for a generic type
Definition iterable_sections.h:71
#define TYPE_SECTION_START(secname)
iterable section start symbol for a generic type
Definition iterable_sections.h:61
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:523
uint32_t log_timestamp_t
Timestamp value associated with a log message.
Definition log_msg.h:54
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:154
Header file for the logging core.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Kernel timeout type.
Definition clock.h:65
MPSC packet buffer structure.
Definition mpsc_pbuf.h:90
Generic packet header.
Definition mpsc_packet.h:49