13#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_LINK_H_
14#define ZEPHYR_INCLUDE_LOGGING_LOG_LINK_H_
42 union log_msg_generic *msg);
71 char *buf,
size_t *length);
74 uint16_t source_id,
char *buf,
size_t *length);
89 (CONFIG_LOG_REMOTE_DOMAIN_MAX_COUNT),
123#define LOG_LINK_DEF(_name, _api, _buf_wlen, _ctx) \
124 static uint32_t __aligned(Z_LOG_MSG_ALIGNMENT) _name##_buf32[_buf_wlen]; \
125 static const struct mpsc_pbuf_buffer_config _name##_mpsc_pbuf_config = { \
126 .buf = (uint32_t *)_name##_buf32, \
128 .notify_drop = z_log_notify_drop, \
129 .get_wlen = log_msg_generic_get_wlen, \
130 .flags = IS_ENABLED(CONFIG_LOG_MODE_OVERFLOW) ? \
131 MPSC_PBUF_MODE_OVERWRITE : 0 \
133 COND_CODE_0(_buf_wlen, (), (static STRUCT_SECTION_ITERABLE(log_msg_ptr, \
134 _name##_log_msg_ptr);)) \
135 static STRUCT_SECTION_ITERABLE_ALTERNATE(log_mpsc_pbuf, \
137 _name##_log_mpsc_pbuf); \
138 static struct log_link_ctrl_blk _name##_ctrl_blk; \
139 static const STRUCT_SECTION_ITERABLE(log_link, _name) = \
142 .name = STRINGIFY(_name), \
143 .ctrl_blk = &_name##_ctrl_blk, \
145 .mpsc_pbuf = _buf_wlen ? &_name##_log_mpsc_pbuf : NULL, \
146 .mpsc_pbuf_config = _buf_wlen ? &_name##_mpsc_pbuf_config : NULL \
163 __ASSERT_NO_MSG(link);
181 __ASSERT_NO_MSG(link);
206 __ASSERT_NO_MSG(link);
221 __ASSERT_NO_MSG(link);
223 return link->
ctrl_blk->source_cnt[domain_id];
242 __ASSERT_NO_MSG(link);
261 char *
buf,
size_t *length)
263 __ASSERT_NO_MSG(link);
264 __ASSERT_NO_MSG(
buf);
284 __ASSERT_NO_MSG(link);
287 level, runtime_level);
303 __ASSERT_NO_MSG(link);
304 __ASSERT_NO_MSG(level);
319void z_log_msg_enqueue(
const struct log_link *link,
const void *data,
size_t len);
static int log_link_get_levels(const struct log_link *link, uint32_t domain_id, uint16_t source_id, uint8_t *level, uint8_t *runtime_level)
Get level settings of the given source.
Definition log_link.h:280
static int log_link_get_domain_name(const struct log_link *link, uint32_t domain_id, char *buf, size_t *length)
Get domain name.
Definition log_link.h:238
static int log_link_activate(const struct log_link *link)
Activate log link.
Definition log_link.h:179
static int log_link_set_runtime_level(const struct log_link *link, uint32_t domain_id, uint16_t source_id, uint8_t level)
Set runtime level of the given source.
Definition log_link.h:299
void(* log_link_dropped_cb_t)(const struct log_link *link, uint32_t dropped)
Callback invoked by a link to report dropped messages.
Definition log_link.h:50
static uint16_t log_link_sources_count(const struct log_link *link, uint32_t domain_id)
Get number of sources in the domain.
Definition log_link.h:218
static int log_link_is_active(const struct log_link *link)
Check if link is activated.
Definition log_link.h:193
static uint8_t log_link_domains_count(const struct log_link *link)
Get number of domains in the link.
Definition log_link.h:204
static int log_link_get_source_name(const struct log_link *link, uint32_t domain_id, uint16_t source_id, char *buf, size_t *length)
Get source name.
Definition log_link.h:259
void(* log_link_callback_t)(const struct log_link *link, union log_msg_generic *msg)
Callback invoked by a link for each received log message.
Definition log_link.h:41
static int log_link_initiate(const struct log_link *link, struct log_link_config *config)
Initiate log link.
Definition log_link.h:160
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition util_macro.h:209
#define EINPROGRESS
Operation now in progress.
Definition errno.h:104
Header file for logging internal functions.
Header file for log messages.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Log link API.
Definition log_link.h:64
int(* activate)(const struct log_link *link)
Complete link activation (see log_link_activate()).
Definition log_link.h:68
int(* get_source_name)(const struct log_link *link, uint32_t domain_id, uint16_t source_id, char *buf, size_t *length)
Get a source name (see log_link_get_source_name()).
Definition log_link.h:73
int(* get_domain_name)(const struct log_link *link, uint32_t domain_id, char *buf, size_t *length)
Get a domain name (see log_link_get_domain_name()).
Definition log_link.h:70
int(* initiate)(const struct log_link *link, struct log_link_config *config)
Initiate the link (see log_link_initiate()).
Definition log_link.h:66
int(* set_runtime_level)(const struct log_link *link, uint32_t domain_id, uint16_t source_id, uint8_t level)
Set runtime level of a source (see log_link_set_runtime_level()).
Definition log_link.h:80
int(* get_levels)(const struct log_link *link, uint32_t domain_id, uint16_t source_id, uint8_t *level, uint8_t *runtime_level)
Get level settings of a source (see log_link_get_levels()).
Definition log_link.h:76
Log link configuration passed to the link at initiation time.
Definition log_link.h:54
log_link_dropped_cb_t dropped_cb
Callback for dropped messages.
Definition log_link.h:56
log_link_callback_t msg_cb
Callback for received messages.
Definition log_link.h:55
Run-time control block for a Log links instance.
Definition log_link.h:85
Log link instance.
Definition log_link.h:97
void * ctx
Context associated with the link.
Definition log_link.h:101
const struct log_link_api * api
Link operations.
Definition log_link.h:98
const char * name
Unique link name.
Definition log_link.h:99
struct log_link_ctrl_blk * ctrl_blk
Run-time control block.
Definition log_link.h:100
MPSC packet buffer configuration.
Definition mpsc_pbuf.h:131
uint32_t * buf
Definition mpsc_pbuf.h:133
MPSC packet buffer structure.
Definition mpsc_pbuf.h:90
Iterable sections helpers.