Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
log_msg.h File Reference
#include <sys/atomic.h>
#include <sys/util.h>
#include <string.h>
#include <logging/log_msg2.h>

Go to the source code of this file.

Data Structures

struct  log_msg_ids
 Part of log message header identifying source and level. More...
 
struct  log_msg_generic_hdr
 
struct  log_msg_std_hdr
 
struct  log_msg_hexdump_hdr
 
struct  log_msg_hdr
 
union  log_msg_hdr::log_msg_hdr_params
 
union  log_msg_head_data
 Data part of log message. More...
 
struct  log_msg_ext_head_data
 Data part of extended log message. More...
 
union  log_msg_ext_head_data::log_msg_ext_head_data_data
 
struct  log_msg
 Log message structure. More...
 
union  log_msg::log_msg_data
 
struct  log_msg_cont
 Chunks following message head when message is extended. More...
 
union  log_msg_cont::log_msg_cont_data
 
union  log_msg_chunk
 Log message. More...
 

Macros

#define LOG_MAX_NARGS   15
 Maximum number of arguments in the standard log entry. More...
 
#define LOG_MSG_NARGS_SINGLE_CHUNK   3U
 Number of arguments in the log entry which fits in one chunk. More...
 
#define LOG_MSG_NARGS_HEAD_CHUNK    (LOG_MSG_NARGS_SINGLE_CHUNK - (sizeof(void *)/sizeof(log_arg_t)))
 Number of arguments in the head of extended standard log message.. More...
 
#define LOG_MSG_HEXDUMP_BYTES_SINGLE_CHUNK    (LOG_MSG_NARGS_SINGLE_CHUNK * sizeof(log_arg_t))
 Maximal amount of bytes in the hexdump entry which fits in one chunk. More...
 
#define LOG_MSG_HEXDUMP_BYTES_HEAD_CHUNK    (LOG_MSG_HEXDUMP_BYTES_SINGLE_CHUNK - sizeof(void *))
 Number of bytes in the first chunk of hexdump message if message consists of more than one chunk. More...
 
#define HEXDUMP_BYTES_CONT_MSG    (sizeof(struct log_msg) - sizeof(void *))
 Number of bytes that can be stored in chunks following head chunk in hexdump log message. More...
 
#define ARGS_CONT_MSG   (HEXDUMP_BYTES_CONT_MSG / sizeof(log_arg_t))
 
#define LOG_MSG_TYPE_STD   0U
 Flag indicating standard log message. More...
 
#define LOG_MSG_TYPE_HEXDUMP   1
 Flag indicating hexdump log message. More...
 
#define COMMON_PARAM_HDR()
 Common part of log message header. More...
 
#define LOG_MSG_HEXDUMP_LENGTH_BITS   14
 Number of bits used for storing length of hexdump log message. More...
 
#define LOG_MSG_HEXDUMP_MAX_LENGTH   (BIT(LOG_MSG_HEXDUMP_LENGTH_BITS) - 1)
 Maximum length of log hexdump message. More...
 

Typedefs

typedef unsigned long log_arg_t
 Log argument type. More...
 

Functions

void log_msg_pool_init (void)
 Function for initialization of the log message pool. More...
 
void log_msg_get (struct log_msg *msg)
 Function for indicating that message is in use. More...
 
void log_msg_put (struct log_msg *msg)
 Function for indicating that message is no longer in use. More...
 
static uint32_t log_msg_domain_id_get (struct log_msg *msg)
 Get domain ID of the message. More...
 
static uint32_t log_msg_source_id_get (struct log_msg *msg)
 Get source ID (module or instance) of the message. More...
 
static uint32_t log_msg_level_get (struct log_msg *msg)
 Get severity level of the message. More...
 
static uint32_t log_msg_timestamp_get (struct log_msg *msg)
 Get timestamp of the message. More...
 
static bool log_msg_is_std (struct log_msg *msg)
 Check if message is of standard type. More...
 
uint32_t log_msg_nargs_get (struct log_msg *msg)
 Returns number of arguments in standard log message. More...
 
log_arg_t log_msg_arg_get (struct log_msg *msg, uint32_t arg_idx)
 Gets argument from standard log message. More...
 
const char * log_msg_str_get (struct log_msg *msg)
 Gets pointer to the unformatted string from standard log message. More...
 
struct log_msglog_msg_hexdump_create (const char *str, const uint8_t *data, uint32_t length)
 Allocates chunks for hexdump message and copies the data. More...
 
void log_msg_hexdump_data_put (struct log_msg *msg, uint8_t *data, size_t *length, size_t offset)
 Put data into hexdump log message. More...
 
void log_msg_hexdump_data_get (struct log_msg *msg, uint8_t *data, size_t *length, size_t offset)
 Get data from hexdump log message. More...
 
union log_msg_chunklog_msg_no_space_handle (void)
 
union log_msg_chunklog_msg_chunk_alloc (void)
 Allocate single chunk from the pool. More...
 
static struct log_msglog_msg_create_0 (const char *str)
 Create standard log message with no arguments. More...
 
static struct log_msglog_msg_create_1 (const char *str, log_arg_t arg1)
 Create standard log message with one argument. More...
 
static struct log_msglog_msg_create_2 (const char *str, log_arg_t arg1, log_arg_t arg2)
 Create standard log message with two arguments. More...
 
static struct log_msglog_msg_create_3 (const char *str, log_arg_t arg1, log_arg_t arg2, log_arg_t arg3)
 Create standard log message with three arguments. More...
 
struct log_msglog_msg_create_n (const char *str, log_arg_t *args, uint32_t nargs)
 Create standard log message with variable number of arguments. More...
 
uint32_t log_msg_mem_get_free (void)
 Get number of free blocks from the log mem pool. More...
 
uint32_t log_msg_mem_get_used (void)
 Get number of used blocks from the log mem pool. More...
 
uint32_t log_msg_mem_get_max_used (void)
 Get max used blocks from the log mem pool. More...