logging: Removing v2 suffix from logging names
Renaming objects which had 2 in the name to indicate that it is v2 specific. Once logging v1 has been removed such suffixes are redundant. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
318e6db239
commit
9833ca61c9
45 changed files with 363 additions and 373 deletions
|
@ -31,7 +31,7 @@ struct log_backend;
|
||||||
*/
|
*/
|
||||||
struct log_backend_api {
|
struct log_backend_api {
|
||||||
void (*process)(const struct log_backend *const backend,
|
void (*process)(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg);
|
union log_msg_generic *msg);
|
||||||
|
|
||||||
void (*dropped)(const struct log_backend *const backend, uint32_t cnt);
|
void (*dropped)(const struct log_backend *const backend, uint32_t cnt);
|
||||||
void (*panic)(const struct log_backend *const backend);
|
void (*panic)(const struct log_backend *const backend);
|
||||||
|
@ -137,9 +137,8 @@ static inline int log_backend_is_ready(const struct log_backend *const backend)
|
||||||
* @param[in] backend Pointer to the backend instance.
|
* @param[in] backend Pointer to the backend instance.
|
||||||
* @param[in] msg Pointer to message with log entry.
|
* @param[in] msg Pointer to message with log entry.
|
||||||
*/
|
*/
|
||||||
static inline void log_backend_msg2_process(
|
static inline void log_backend_msg_process(const struct log_backend *const backend,
|
||||||
const struct log_backend *const backend,
|
union log_msg_generic *msg)
|
||||||
union log_msg2_generic *msg)
|
|
||||||
{
|
{
|
||||||
__ASSERT_NO_MSG(backend != NULL);
|
__ASSERT_NO_MSG(backend != NULL);
|
||||||
__ASSERT_NO_MSG(msg != NULL);
|
__ASSERT_NO_MSG(msg != NULL);
|
||||||
|
|
|
@ -461,7 +461,7 @@ void z_log_printf_arg_checker(const char *fmt, ...)
|
||||||
*/
|
*/
|
||||||
static inline void log2_generic(uint8_t level, const char *fmt, va_list ap)
|
static inline void log2_generic(uint8_t level, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
z_log_msg2_runtime_vcreate(CONFIG_LOG_DOMAIN_ID, NULL, level,
|
z_log_msg_runtime_vcreate(CONFIG_LOG_DOMAIN_ID, NULL, level,
|
||||||
NULL, 0, 0, fmt, ap);
|
NULL, 0, 0, fmt, ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ uint32_t log_get_strdup_longest_string(void);
|
||||||
*/
|
*/
|
||||||
static inline bool log_data_pending(void)
|
static inline bool log_data_pending(void)
|
||||||
{
|
{
|
||||||
return IS_ENABLED(CONFIG_LOG_MODE_DEFERRED) ? z_log_msg2_pending() : false;
|
return IS_ENABLED(CONFIG_LOG_MODE_DEFERRED) ? z_log_msg_pending() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,7 +29,7 @@ void log_frontend_init(void);
|
||||||
* @param data Hexdump data. Length is in @p desc.
|
* @param data Hexdump data. Length is in @p desc.
|
||||||
*/
|
*/
|
||||||
void log_frontend_msg(const void *source,
|
void log_frontend_msg(const void *source,
|
||||||
const struct log_msg2_desc desc,
|
const struct log_msg_desc desc,
|
||||||
uint8_t *package, const void *data);
|
uint8_t *package, const void *data);
|
||||||
|
|
||||||
/** @brief Panic state notification. */
|
/** @brief Panic state notification. */
|
||||||
|
|
|
@ -70,13 +70,13 @@ static inline uint32_t z_log_sources_count(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Initialize module for handling logging message. */
|
/** @brief Initialize module for handling logging message. */
|
||||||
void z_log_msg2_init(void);
|
void z_log_msg_init(void);
|
||||||
|
|
||||||
/** @brief Commit log message.
|
/** @brief Commit log message.
|
||||||
*
|
*
|
||||||
* @param msg Message.
|
* @param msg Message.
|
||||||
*/
|
*/
|
||||||
void z_log_msg2_commit(struct log_msg2 *msg);
|
void z_log_msg_commit(struct log_msg *msg);
|
||||||
|
|
||||||
/** @brief Get pending log message.
|
/** @brief Get pending log message.
|
||||||
*
|
*
|
||||||
|
@ -84,20 +84,20 @@ void z_log_msg2_commit(struct log_msg2 *msg);
|
||||||
*
|
*
|
||||||
* @param Message or null if no pending messages.
|
* @param Message or null if no pending messages.
|
||||||
*/
|
*/
|
||||||
union log_msg2_generic *z_log_msg2_claim(void);
|
union log_msg_generic *z_log_msg_claim(void);
|
||||||
|
|
||||||
/** @brief Free message.
|
/** @brief Free message.
|
||||||
*
|
*
|
||||||
* @param msg Message.
|
* @param msg Message.
|
||||||
*/
|
*/
|
||||||
void z_log_msg2_free(union log_msg2_generic *msg);
|
void z_log_msg_free(union log_msg_generic *msg);
|
||||||
|
|
||||||
/** @brief Check if there are any message pending.
|
/** @brief Check if there are any message pending.
|
||||||
*
|
*
|
||||||
* @retval true if at least one message is pending.
|
* @retval true if at least one message is pending.
|
||||||
* @retval false if no message is pending.
|
* @retval false if no message is pending.
|
||||||
*/
|
*/
|
||||||
bool z_log_msg2_pending(void);
|
bool z_log_msg_pending(void);
|
||||||
|
|
||||||
/** @brief Get tag.
|
/** @brief Get tag.
|
||||||
*
|
*
|
||||||
|
|
|
@ -48,7 +48,7 @@ typedef uint32_t log_timestamp_t;
|
||||||
MPSC_PBUF_HDR;\
|
MPSC_PBUF_HDR;\
|
||||||
uint32_t type:1
|
uint32_t type:1
|
||||||
|
|
||||||
struct log_msg2_desc {
|
struct log_msg_desc {
|
||||||
LOG_MSG2_GENERIC_HDR;
|
LOG_MSG2_GENERIC_HDR;
|
||||||
uint32_t domain:3;
|
uint32_t domain:3;
|
||||||
uint32_t level:3;
|
uint32_t level:3;
|
||||||
|
@ -57,14 +57,14 @@ struct log_msg2_desc {
|
||||||
uint32_t reserved:1;
|
uint32_t reserved:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
union log_msg2_source {
|
union log_msg_source {
|
||||||
const struct log_source_const_data *fixed;
|
const struct log_source_const_data *fixed;
|
||||||
struct log_source_dynamic_data *dynamic;
|
struct log_source_dynamic_data *dynamic;
|
||||||
void *raw;
|
void *raw;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct log_msg2_hdr {
|
struct log_msg_hdr {
|
||||||
struct log_msg2_desc desc;
|
struct log_msg_desc desc;
|
||||||
/* Attempting to keep best alignment. When address is 64 bit and timestamp 32
|
/* Attempting to keep best alignment. When address is 64 bit and timestamp 32
|
||||||
* swap the order to have 16 byte header instead of 24 byte.
|
* swap the order to have 16 byte header instead of 24 byte.
|
||||||
*/
|
*/
|
||||||
|
@ -81,12 +81,12 @@ struct log_msg2_hdr {
|
||||||
#define Z_LOG_MSG2_ALIGNMENT CBPRINTF_PACKAGE_ALIGNMENT
|
#define Z_LOG_MSG2_ALIGNMENT CBPRINTF_PACKAGE_ALIGNMENT
|
||||||
|
|
||||||
#define Z_LOG_MSG2_PADDING \
|
#define Z_LOG_MSG2_PADDING \
|
||||||
((sizeof(struct log_msg2_hdr) % Z_LOG_MSG2_ALIGNMENT) > 0 ? \
|
((sizeof(struct log_msg_hdr) % Z_LOG_MSG2_ALIGNMENT) > 0 ? \
|
||||||
(Z_LOG_MSG2_ALIGNMENT - (sizeof(struct log_msg2_hdr) % Z_LOG_MSG2_ALIGNMENT)) : \
|
(Z_LOG_MSG2_ALIGNMENT - (sizeof(struct log_msg_hdr) % Z_LOG_MSG2_ALIGNMENT)) : \
|
||||||
0)
|
0)
|
||||||
|
|
||||||
struct log_msg2 {
|
struct log_msg {
|
||||||
struct log_msg2_hdr hdr;
|
struct log_msg_hdr hdr;
|
||||||
/* Adding padding to ensure that cbprintf package that follows is
|
/* Adding padding to ensure that cbprintf package that follows is
|
||||||
* properly aligned.
|
* properly aligned.
|
||||||
*/
|
*/
|
||||||
|
@ -94,21 +94,21 @@ struct log_msg2 {
|
||||||
uint8_t data[];
|
uint8_t data[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct log_msg2_generic_hdr {
|
struct log_msg_generic_hdr {
|
||||||
LOG_MSG2_GENERIC_HDR;
|
LOG_MSG2_GENERIC_HDR;
|
||||||
};
|
};
|
||||||
|
|
||||||
union log_msg2_generic {
|
union log_msg_generic {
|
||||||
union mpsc_pbuf_generic buf;
|
union mpsc_pbuf_generic buf;
|
||||||
struct log_msg2_generic_hdr generic;
|
struct log_msg_generic_hdr generic;
|
||||||
struct log_msg2 log;
|
struct log_msg log;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Method used for creating a log message.
|
/** @brief Method used for creating a log message.
|
||||||
*
|
*
|
||||||
* It is used for testing purposes to validate that expected mode was used.
|
* It is used for testing purposes to validate that expected mode was used.
|
||||||
*/
|
*/
|
||||||
enum z_log_msg2_mode {
|
enum z_log_msg_mode {
|
||||||
/* Runtime mode is least efficient but supports all cases thus it is
|
/* Runtime mode is least efficient but supports all cases thus it is
|
||||||
* treated as a fallback method when others cannot be used.
|
* treated as a fallback method when others cannot be used.
|
||||||
*/
|
*/
|
||||||
|
@ -141,12 +141,12 @@ enum z_log_msg2_mode {
|
||||||
#define Z_LOG_MSG2_CBPRINTF_FLAGS(_cstr_cnt) \
|
#define Z_LOG_MSG2_CBPRINTF_FLAGS(_cstr_cnt) \
|
||||||
(CBPRINTF_PACKAGE_FIRST_RO_STR_CNT(_cstr_cnt))
|
(CBPRINTF_PACKAGE_FIRST_RO_STR_CNT(_cstr_cnt))
|
||||||
|
|
||||||
#ifdef CONFIG_LOG2_USE_VLA
|
#ifdef CONFIG_LOG_USE_VLA
|
||||||
#define Z_LOG_MSG2_ON_STACK_ALLOC(ptr, len) \
|
#define Z_LOG_MSG2_ON_STACK_ALLOC(ptr, len) \
|
||||||
long long _ll_buf[ceiling_fraction(len, sizeof(long long))]; \
|
long long _ll_buf[ceiling_fraction(len, sizeof(long long))]; \
|
||||||
long double _ld_buf[ceiling_fraction(len, sizeof(long double))]; \
|
long double _ld_buf[ceiling_fraction(len, sizeof(long double))]; \
|
||||||
ptr = (sizeof(long double) == Z_LOG_MSG2_ALIGNMENT) ? \
|
ptr = (sizeof(long double) == Z_LOG_MSG2_ALIGNMENT) ? \
|
||||||
(struct log_msg2 *)_ld_buf : (struct log_msg2 *)_ll_buf; \
|
(struct log_msg *)_ld_buf : (struct log_msg *)_ll_buf; \
|
||||||
if (IS_ENABLED(CONFIG_LOG_TEST_CLEAR_MESSAGE_SPACE)) { \
|
if (IS_ENABLED(CONFIG_LOG_TEST_CLEAR_MESSAGE_SPACE)) { \
|
||||||
/* During test fill with 0's to simplify message comparison */ \
|
/* During test fill with 0's to simplify message comparison */ \
|
||||||
memset(ptr, 0, len); \
|
memset(ptr, 0, len); \
|
||||||
|
@ -169,17 +169,17 @@ enum z_log_msg2_mode {
|
||||||
long double _ld_buf128[128 / sizeof(long double)]; \
|
long double _ld_buf128[128 / sizeof(long double)]; \
|
||||||
long double _ld_buf256[256 / sizeof(long double)]; \
|
long double _ld_buf256[256 / sizeof(long double)]; \
|
||||||
if (sizeof(long double) == Z_LOG_MSG2_ALIGNMENT) { \
|
if (sizeof(long double) == Z_LOG_MSG2_ALIGNMENT) { \
|
||||||
ptr = (len > 128) ? (struct log_msg2 *)_ld_buf256 : \
|
ptr = (len > 128) ? (struct log_msg *)_ld_buf256 : \
|
||||||
((len > 64) ? (struct log_msg2 *)_ld_buf128 : \
|
((len > 64) ? (struct log_msg *)_ld_buf128 : \
|
||||||
((len > 48) ? (struct log_msg2 *)_ld_buf64 : \
|
((len > 48) ? (struct log_msg *)_ld_buf64 : \
|
||||||
((len > 32) ? (struct log_msg2 *)_ld_buf48 : \
|
((len > 32) ? (struct log_msg *)_ld_buf48 : \
|
||||||
(struct log_msg2 *)_ld_buf32)));\
|
(struct log_msg *)_ld_buf32)));\
|
||||||
} else { \
|
} else { \
|
||||||
ptr = (len > 128) ? (struct log_msg2 *)_ll_buf256 : \
|
ptr = (len > 128) ? (struct log_msg *)_ll_buf256 : \
|
||||||
((len > 64) ? (struct log_msg2 *)_ll_buf128 : \
|
((len > 64) ? (struct log_msg *)_ll_buf128 : \
|
||||||
((len > 48) ? (struct log_msg2 *)_ll_buf64 : \
|
((len > 48) ? (struct log_msg *)_ll_buf64 : \
|
||||||
((len > 32) ? (struct log_msg2 *)_ll_buf48 : \
|
((len > 32) ? (struct log_msg *)_ll_buf48 : \
|
||||||
(struct log_msg2 *)_ll_buf32)));\
|
(struct log_msg *)_ll_buf32)));\
|
||||||
} \
|
} \
|
||||||
if (IS_ENABLED(CONFIG_LOG_TEST_CLEAR_MESSAGE_SPACE)) { \
|
if (IS_ENABLED(CONFIG_LOG_TEST_CLEAR_MESSAGE_SPACE)) { \
|
||||||
/* During test fill with 0's to simplify message comparison */ \
|
/* During test fill with 0's to simplify message comparison */ \
|
||||||
|
@ -188,10 +188,10 @@ enum z_log_msg2_mode {
|
||||||
#endif /* Z_LOG_MSG2_USE_VLA */
|
#endif /* Z_LOG_MSG2_USE_VLA */
|
||||||
|
|
||||||
#define Z_LOG_MSG2_ALIGN_OFFSET \
|
#define Z_LOG_MSG2_ALIGN_OFFSET \
|
||||||
offsetof(struct log_msg2, data)
|
offsetof(struct log_msg, data)
|
||||||
|
|
||||||
#define Z_LOG_MSG2_LEN(pkg_len, data_len) \
|
#define Z_LOG_MSG2_LEN(pkg_len, data_len) \
|
||||||
(offsetof(struct log_msg2, data) + pkg_len + (data_len))
|
(offsetof(struct log_msg, data) + pkg_len + (data_len))
|
||||||
|
|
||||||
#define Z_LOG_MSG2_ALIGNED_WLEN(pkg_len, data_len) \
|
#define Z_LOG_MSG2_ALIGNED_WLEN(pkg_len, data_len) \
|
||||||
ceiling_fraction(ROUND_UP(Z_LOG_MSG2_LEN(pkg_len, data_len), \
|
ceiling_fraction(ROUND_UP(Z_LOG_MSG2_LEN(pkg_len, data_len), \
|
||||||
|
@ -209,19 +209,19 @@ do { \
|
||||||
CBPRINTF_STATIC_PACKAGE(NULL, 0, _plen, Z_LOG_MSG2_ALIGN_OFFSET, flags, \
|
CBPRINTF_STATIC_PACKAGE(NULL, 0, _plen, Z_LOG_MSG2_ALIGN_OFFSET, flags, \
|
||||||
__VA_ARGS__); \
|
__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
struct log_msg2 *_msg; \
|
struct log_msg *_msg; \
|
||||||
Z_LOG_MSG2_ON_STACK_ALLOC(_msg, Z_LOG_MSG2_LEN(_plen, 0)); \
|
Z_LOG_MSG2_ON_STACK_ALLOC(_msg, Z_LOG_MSG2_LEN(_plen, 0)); \
|
||||||
if (_plen) { \
|
if (_plen) { \
|
||||||
CBPRINTF_STATIC_PACKAGE(_msg->data, _plen, \
|
CBPRINTF_STATIC_PACKAGE(_msg->data, _plen, \
|
||||||
_plen, Z_LOG_MSG2_ALIGN_OFFSET, flags, \
|
_plen, Z_LOG_MSG2_ALIGN_OFFSET, flags, \
|
||||||
__VA_ARGS__);\
|
__VA_ARGS__);\
|
||||||
} \
|
} \
|
||||||
struct log_msg2_desc _desc = \
|
struct log_msg_desc _desc = \
|
||||||
Z_LOG_MSG_DESC_INITIALIZER(_domain_id, _level, \
|
Z_LOG_MSG_DESC_INITIALIZER(_domain_id, _level, \
|
||||||
(uint32_t)_plen, _dlen); \
|
(uint32_t)_plen, _dlen); \
|
||||||
LOG_MSG2_DBG("creating message on stack: package len: %d, data len: %d\n", \
|
LOG_MSG2_DBG("creating message on stack: package len: %d, data len: %d\n", \
|
||||||
_plen, (int)(_dlen)); \
|
_plen, (int)(_dlen)); \
|
||||||
z_log_msg2_static_create((void *)_source, _desc, _msg->data, _data); \
|
z_log_msg_static_create((void *)_source, _desc, _msg->data, _data); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#ifdef CONFIG_LOG_SPEED
|
#ifdef CONFIG_LOG_SPEED
|
||||||
|
@ -231,8 +231,8 @@ do { \
|
||||||
Z_LOG_MSG2_CBPRINTF_FLAGS(_cstr_cnt), \
|
Z_LOG_MSG2_CBPRINTF_FLAGS(_cstr_cnt), \
|
||||||
__VA_ARGS__); \
|
__VA_ARGS__); \
|
||||||
size_t _msg_wlen = Z_LOG_MSG2_ALIGNED_WLEN(_plen, 0); \
|
size_t _msg_wlen = Z_LOG_MSG2_ALIGNED_WLEN(_plen, 0); \
|
||||||
struct log_msg2 *_msg = z_log_msg2_alloc(_msg_wlen); \
|
struct log_msg *_msg = z_log_msg_alloc(_msg_wlen); \
|
||||||
struct log_msg2_desc _desc = \
|
struct log_msg_desc _desc = \
|
||||||
Z_LOG_MSG_DESC_INITIALIZER(_domain_id, _level, (uint32_t)_plen, 0); \
|
Z_LOG_MSG_DESC_INITIALIZER(_domain_id, _level, (uint32_t)_plen, 0); \
|
||||||
LOG_MSG2_DBG("creating message zero copy: package len: %d, msg: %p\n", \
|
LOG_MSG2_DBG("creating message zero copy: package len: %d, msg: %p\n", \
|
||||||
_plen, _msg); \
|
_plen, _msg); \
|
||||||
|
@ -242,7 +242,7 @@ do { \
|
||||||
Z_LOG_MSG2_CBPRINTF_FLAGS(_cstr_cnt), \
|
Z_LOG_MSG2_CBPRINTF_FLAGS(_cstr_cnt), \
|
||||||
__VA_ARGS__); \
|
__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
z_log_msg2_finalize(_msg, (void *)_source, _desc, NULL); \
|
z_log_msg_finalize(_msg, (void *)_source, _desc, NULL); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
/* Alternative empty macro created to speed up compilation when LOG_SPEED is
|
/* Alternative empty macro created to speed up compilation when LOG_SPEED is
|
||||||
|
@ -255,7 +255,7 @@ do { \
|
||||||
* replaces original string literal with that variable.
|
* replaces original string literal with that variable.
|
||||||
*/
|
*/
|
||||||
#define Z_LOG_FMT_ARGS_2(_name, ...) \
|
#define Z_LOG_FMT_ARGS_2(_name, ...) \
|
||||||
COND_CODE_1(CONFIG_LOG2_FMT_SECTION, \
|
COND_CODE_1(CONFIG_LOG_FMT_SECTION, \
|
||||||
(COND_CODE_0(NUM_VA_ARGS_LESS_1(__VA_ARGS__), \
|
(COND_CODE_0(NUM_VA_ARGS_LESS_1(__VA_ARGS__), \
|
||||||
(_name), (_name, GET_ARGS_LESS_N(1, __VA_ARGS__)))), \
|
(_name), (_name, GET_ARGS_LESS_N(1, __VA_ARGS__)))), \
|
||||||
(__VA_ARGS__))
|
(__VA_ARGS__))
|
||||||
|
@ -274,10 +274,10 @@ do { \
|
||||||
(NULL), \
|
(NULL), \
|
||||||
(Z_LOG_FMT_ARGS_2(_name, ##__VA_ARGS__)))
|
(Z_LOG_FMT_ARGS_2(_name, ##__VA_ARGS__)))
|
||||||
|
|
||||||
#if defined(CONFIG_LOG2_USE_TAGGED_ARGUMENTS)
|
#if defined(CONFIG_LOG_USE_TAGGED_ARGUMENTS)
|
||||||
|
|
||||||
#define Z_LOG_FMT_TAGGED_ARGS_2(_name, ...) \
|
#define Z_LOG_FMT_TAGGED_ARGS_2(_name, ...) \
|
||||||
COND_CODE_1(CONFIG_LOG2_FMT_SECTION, \
|
COND_CODE_1(CONFIG_LOG_FMT_SECTION, \
|
||||||
(_name, Z_CBPRINTF_TAGGED_ARGS(NUM_VA_ARGS_LESS_1(__VA_ARGS__), \
|
(_name, Z_CBPRINTF_TAGGED_ARGS(NUM_VA_ARGS_LESS_1(__VA_ARGS__), \
|
||||||
GET_ARGS_LESS_N(1, __VA_ARGS__))), \
|
GET_ARGS_LESS_N(1, __VA_ARGS__))), \
|
||||||
(GET_ARG_N(1, __VA_ARGS__), \
|
(GET_ARG_N(1, __VA_ARGS__), \
|
||||||
|
@ -307,7 +307,7 @@ do { \
|
||||||
#define Z_LOG_FMT_RUNTIME_ARGS(...) \
|
#define Z_LOG_FMT_RUNTIME_ARGS(...) \
|
||||||
Z_LOG_FMT_ARGS(__VA_ARGS__)
|
Z_LOG_FMT_ARGS(__VA_ARGS__)
|
||||||
|
|
||||||
#endif /* CONFIG_LOG2_USE_TAGGED_ARGUMENTS */
|
#endif /* CONFIG_LOG_USE_TAGGED_ARGUMENTS */
|
||||||
|
|
||||||
/* Macro handles case when there is no string provided, in that case variable
|
/* Macro handles case when there is no string provided, in that case variable
|
||||||
* is not created.
|
* is not created.
|
||||||
|
@ -327,7 +327,7 @@ do { \
|
||||||
* @param ... Optional log message with arguments (may be empty).
|
* @param ... Optional log message with arguments (may be empty).
|
||||||
*/
|
*/
|
||||||
#define Z_LOG_MSG2_STR_VAR(_name, ...) \
|
#define Z_LOG_MSG2_STR_VAR(_name, ...) \
|
||||||
IF_ENABLED(CONFIG_LOG2_FMT_SECTION, \
|
IF_ENABLED(CONFIG_LOG_FMT_SECTION, \
|
||||||
(Z_LOG_MSG2_STR_VAR_IN_SECTION(_name, ##__VA_ARGS__)))
|
(Z_LOG_MSG2_STR_VAR_IN_SECTION(_name, ##__VA_ARGS__)))
|
||||||
|
|
||||||
/** @brief Create log message and write it into the logger buffer.
|
/** @brief Create log message and write it into the logger buffer.
|
||||||
|
@ -369,22 +369,22 @@ do { \
|
||||||
*
|
*
|
||||||
* @param ... Optional string with arguments (fmt, ...). It may be empty.
|
* @param ... Optional string with arguments (fmt, ...). It may be empty.
|
||||||
*/
|
*/
|
||||||
#if defined(CONFIG_LOG2_ALWAYS_RUNTIME) || \
|
#if defined(CONFIG_LOG_ALWAYS_RUNTIME) || \
|
||||||
(!defined(CONFIG_LOG) && \
|
(!defined(CONFIG_LOG) && \
|
||||||
(!TOOLCHAIN_HAS_PRAGMA_DIAG || !TOOLCHAIN_HAS_C_AUTO_TYPE))
|
(!TOOLCHAIN_HAS_PRAGMA_DIAG || !TOOLCHAIN_HAS_C_AUTO_TYPE))
|
||||||
#define Z_LOG_MSG2_CREATE2(_try_0cpy, _mode, _cstr_cnt, _domain_id, _source,\
|
#define Z_LOG_MSG2_CREATE2(_try_0cpy, _mode, _cstr_cnt, _domain_id, _source,\
|
||||||
_level, _data, _dlen, ...) \
|
_level, _data, _dlen, ...) \
|
||||||
do {\
|
do {\
|
||||||
Z_LOG_MSG2_STR_VAR(_fmt, ##__VA_ARGS__) \
|
Z_LOG_MSG2_STR_VAR(_fmt, ##__VA_ARGS__) \
|
||||||
z_log_msg2_runtime_create(_domain_id, (void *)_source, \
|
z_log_msg_runtime_create(_domain_id, (void *)_source, \
|
||||||
_level, (uint8_t *)_data, _dlen,\
|
_level, (uint8_t *)_data, _dlen,\
|
||||||
Z_LOG_MSG2_CBPRINTF_FLAGS(_cstr_cnt) | \
|
Z_LOG_MSG2_CBPRINTF_FLAGS(_cstr_cnt) | \
|
||||||
(IS_ENABLED(CONFIG_LOG2_USE_TAGGED_ARGUMENTS) ? \
|
(IS_ENABLED(CONFIG_LOG_USE_TAGGED_ARGUMENTS) ? \
|
||||||
CBPRINTF_PACKAGE_ARGS_ARE_TAGGED : 0), \
|
CBPRINTF_PACKAGE_ARGS_ARE_TAGGED : 0), \
|
||||||
Z_LOG_FMT_RUNTIME_ARGS(_fmt, ##__VA_ARGS__));\
|
Z_LOG_FMT_RUNTIME_ARGS(_fmt, ##__VA_ARGS__));\
|
||||||
_mode = Z_LOG_MSG2_MODE_RUNTIME; \
|
_mode = Z_LOG_MSG2_MODE_RUNTIME; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else /* CONFIG_LOG2_ALWAYS_RUNTIME */
|
#else /* CONFIG_LOG_ALWAYS_RUNTIME */
|
||||||
#define Z_LOG_MSG2_CREATE3(_try_0cpy, _mode, _cstr_cnt, _domain_id, _source,\
|
#define Z_LOG_MSG2_CREATE3(_try_0cpy, _mode, _cstr_cnt, _domain_id, _source,\
|
||||||
_level, _data, _dlen, ...) \
|
_level, _data, _dlen, ...) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -436,7 +436,7 @@ do { \
|
||||||
_level, _data, _dlen, \
|
_level, _data, _dlen, \
|
||||||
FOR_EACH_IDX(Z_LOG_LOCAL_ARG_NAME, (,), __VA_ARGS__)); \
|
FOR_EACH_IDX(Z_LOG_LOCAL_ARG_NAME, (,), __VA_ARGS__)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif /* CONFIG_LOG2_ALWAYS_RUNTIME ||
|
#endif /* CONFIG_LOG_ALWAYS_RUNTIME ||
|
||||||
* (!LOG && (!TOOLCHAIN_HAS_PRAGMA_DIAG || !TOOLCHAIN_HAS_C_AUTO_TYPE))
|
* (!LOG && (!TOOLCHAIN_HAS_PRAGMA_DIAG || !TOOLCHAIN_HAS_C_AUTO_TYPE))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ do { \
|
||||||
*
|
*
|
||||||
* @return allocated space or null if cannot be allocated.
|
* @return allocated space or null if cannot be allocated.
|
||||||
*/
|
*/
|
||||||
struct log_msg2 *z_log_msg2_alloc(uint32_t wlen);
|
struct log_msg *z_log_msg_alloc(uint32_t wlen);
|
||||||
|
|
||||||
/** @brief Finalize message.
|
/** @brief Finalize message.
|
||||||
*
|
*
|
||||||
|
@ -468,8 +468,8 @@ struct log_msg2 *z_log_msg2_alloc(uint32_t wlen);
|
||||||
*
|
*
|
||||||
* @param data Data.
|
* @param data Data.
|
||||||
*/
|
*/
|
||||||
void z_log_msg2_finalize(struct log_msg2 *msg, const void *source,
|
void z_log_msg_finalize(struct log_msg *msg, const void *source,
|
||||||
const struct log_msg2_desc desc, const void *data);
|
const struct log_msg_desc desc, const void *data);
|
||||||
|
|
||||||
/** @brief Create simple message from message details and string package.
|
/** @brief Create simple message from message details and string package.
|
||||||
*
|
*
|
||||||
|
@ -481,8 +481,8 @@ void z_log_msg2_finalize(struct log_msg2 *msg, const void *source,
|
||||||
*
|
*
|
||||||
* @oaram data Data.
|
* @oaram data Data.
|
||||||
*/
|
*/
|
||||||
__syscall void z_log_msg2_static_create(const void *source,
|
__syscall void z_log_msg_static_create(const void *source,
|
||||||
const struct log_msg2_desc desc,
|
const struct log_msg_desc desc,
|
||||||
uint8_t *package, const void *data);
|
uint8_t *package, const void *data);
|
||||||
|
|
||||||
/** @brief Create message at runtime.
|
/** @brief Create message at runtime.
|
||||||
|
@ -506,7 +506,7 @@ __syscall void z_log_msg2_static_create(const void *source,
|
||||||
*
|
*
|
||||||
* @param ap Variable list of string arguments.
|
* @param ap Variable list of string arguments.
|
||||||
*/
|
*/
|
||||||
__syscall void z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
__syscall void z_log_msg_runtime_vcreate(uint8_t domain_id, const void *source,
|
||||||
uint8_t level, const void *data,
|
uint8_t level, const void *data,
|
||||||
size_t dlen, uint32_t package_flags,
|
size_t dlen, uint32_t package_flags,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
|
@ -533,7 +533,7 @@ __syscall void z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
||||||
*
|
*
|
||||||
* @param ... String arguments.
|
* @param ... String arguments.
|
||||||
*/
|
*/
|
||||||
static inline void z_log_msg2_runtime_create(uint8_t domain_id,
|
static inline void z_log_msg_runtime_create(uint8_t domain_id,
|
||||||
const void *source,
|
const void *source,
|
||||||
uint8_t level, const void *data,
|
uint8_t level, const void *data,
|
||||||
size_t dlen, uint32_t package_flags,
|
size_t dlen, uint32_t package_flags,
|
||||||
|
@ -542,12 +542,12 @@ static inline void z_log_msg2_runtime_create(uint8_t domain_id,
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
z_log_msg2_runtime_vcreate(domain_id, source, level,
|
z_log_msg_runtime_vcreate(domain_id, source, level,
|
||||||
data, dlen, package_flags, fmt, ap);
|
data, dlen, package_flags, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool z_log_item_is_msg(const union log_msg2_generic *msg)
|
static inline bool z_log_item_is_msg(const union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
return msg->generic.type == Z_LOG_MSG2_LOG;
|
return msg->generic.type == Z_LOG_MSG2_LOG;
|
||||||
}
|
}
|
||||||
|
@ -558,7 +558,7 @@ static inline bool z_log_item_is_msg(const union log_msg2_generic *msg)
|
||||||
*
|
*
|
||||||
* @return Length.
|
* @return Length.
|
||||||
*/
|
*/
|
||||||
static inline uint32_t log_msg2_get_total_wlen(const struct log_msg2_desc desc)
|
static inline uint32_t log_msg_get_total_wlen(const struct log_msg_desc desc)
|
||||||
{
|
{
|
||||||
return Z_LOG_MSG2_ALIGNED_WLEN(desc.package_len, desc.data_len);
|
return Z_LOG_MSG2_ALIGNED_WLEN(desc.package_len, desc.data_len);
|
||||||
}
|
}
|
||||||
|
@ -569,14 +569,14 @@ static inline uint32_t log_msg2_get_total_wlen(const struct log_msg2_desc desc)
|
||||||
*
|
*
|
||||||
* @return Length in 32 bit words.
|
* @return Length in 32 bit words.
|
||||||
*/
|
*/
|
||||||
static inline uint32_t log_msg2_generic_get_wlen(const union mpsc_pbuf_generic *item)
|
static inline uint32_t log_msg_generic_get_wlen(const union mpsc_pbuf_generic *item)
|
||||||
{
|
{
|
||||||
const union log_msg2_generic *generic_msg = (const union log_msg2_generic *)item;
|
const union log_msg_generic *generic_msg = (const union log_msg_generic *)item;
|
||||||
|
|
||||||
if (z_log_item_is_msg(generic_msg)) {
|
if (z_log_item_is_msg(generic_msg)) {
|
||||||
const struct log_msg2 *msg = (const struct log_msg2 *)generic_msg;
|
const struct log_msg *msg = (const struct log_msg *)generic_msg;
|
||||||
|
|
||||||
return log_msg2_get_total_wlen(msg->hdr.desc);
|
return log_msg_get_total_wlen(msg->hdr.desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -588,7 +588,7 @@ static inline uint32_t log_msg2_generic_get_wlen(const union mpsc_pbuf_generic *
|
||||||
*
|
*
|
||||||
* @return Domain ID
|
* @return Domain ID
|
||||||
*/
|
*/
|
||||||
static inline uint8_t log_msg2_get_domain(struct log_msg2 *msg)
|
static inline uint8_t log_msg_get_domain(struct log_msg *msg)
|
||||||
{
|
{
|
||||||
return msg->hdr.desc.domain;
|
return msg->hdr.desc.domain;
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ static inline uint8_t log_msg2_get_domain(struct log_msg2 *msg)
|
||||||
*
|
*
|
||||||
* @return Log level.
|
* @return Log level.
|
||||||
*/
|
*/
|
||||||
static inline uint8_t log_msg2_get_level(struct log_msg2 *msg)
|
static inline uint8_t log_msg_get_level(struct log_msg *msg)
|
||||||
{
|
{
|
||||||
return msg->hdr.desc.level;
|
return msg->hdr.desc.level;
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ static inline uint8_t log_msg2_get_level(struct log_msg2 *msg)
|
||||||
*
|
*
|
||||||
* @return Pointer to the source data.
|
* @return Pointer to the source data.
|
||||||
*/
|
*/
|
||||||
static inline const void *log_msg2_get_source(struct log_msg2 *msg)
|
static inline const void *log_msg_get_source(struct log_msg *msg)
|
||||||
{
|
{
|
||||||
return msg->hdr.source;
|
return msg->hdr.source;
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ static inline const void *log_msg2_get_source(struct log_msg2 *msg)
|
||||||
*
|
*
|
||||||
* @return Timestamp.
|
* @return Timestamp.
|
||||||
*/
|
*/
|
||||||
static inline log_timestamp_t log_msg2_get_timestamp(struct log_msg2 *msg)
|
static inline log_timestamp_t log_msg_get_timestamp(struct log_msg *msg)
|
||||||
{
|
{
|
||||||
return msg->hdr.timestamp;
|
return msg->hdr.timestamp;
|
||||||
}
|
}
|
||||||
|
@ -634,7 +634,7 @@ static inline log_timestamp_t log_msg2_get_timestamp(struct log_msg2 *msg)
|
||||||
*
|
*
|
||||||
* @return pointer to the data buffer.
|
* @return pointer to the data buffer.
|
||||||
*/
|
*/
|
||||||
static inline uint8_t *log_msg2_get_data(struct log_msg2 *msg, size_t *len)
|
static inline uint8_t *log_msg_get_data(struct log_msg *msg, size_t *len)
|
||||||
{
|
{
|
||||||
*len = msg->hdr.desc.data_len;
|
*len = msg->hdr.desc.data_len;
|
||||||
|
|
||||||
|
@ -649,7 +649,7 @@ static inline uint8_t *log_msg2_get_data(struct log_msg2 *msg, size_t *len)
|
||||||
*
|
*
|
||||||
* @return pointer to the package.
|
* @return pointer to the package.
|
||||||
*/
|
*/
|
||||||
static inline uint8_t *log_msg2_get_package(struct log_msg2 *msg, size_t *len)
|
static inline uint8_t *log_msg_get_package(struct log_msg *msg, size_t *len)
|
||||||
{
|
{
|
||||||
*len = msg->hdr.desc.package_len;
|
*len = msg->hdr.desc.package_len;
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,13 @@ struct log_output {
|
||||||
* @brief Typedef of the function pointer table "format_table".
|
* @brief Typedef of the function pointer table "format_table".
|
||||||
*
|
*
|
||||||
* @param output Pointer to log_output struct.
|
* @param output Pointer to log_output struct.
|
||||||
* @param msg2 Pointer to log_msg2 struct.
|
* @param msg Pointer to log_msg struct.
|
||||||
* @param flags Flags used for text formatting options.
|
* @param flags Flags used for text formatting options.
|
||||||
*
|
*
|
||||||
* @return Function pointer based on Kconfigs defined for backends.
|
* @return Function pointer based on Kconfigs defined for backends.
|
||||||
*/
|
*/
|
||||||
typedef void (*log_format_func_t)(const struct log_output *output,
|
typedef void (*log_format_func_t)(const struct log_output *output,
|
||||||
struct log_msg2 *msg2, uint32_t flags);
|
struct log_msg *msg, uint32_t flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Declaration of the get routine for function pointer table format_table.
|
* @brief Declaration of the get routine for function pointer table format_table.
|
||||||
|
@ -127,8 +127,8 @@ log_format_func_t log_format_func_t_get(uint32_t log_type);
|
||||||
* @param msg Log message.
|
* @param msg Log message.
|
||||||
* @param flags Optional flags.
|
* @param flags Optional flags.
|
||||||
*/
|
*/
|
||||||
void log_output_msg2_process(const struct log_output *log_output,
|
void log_output_msg_process(const struct log_output *log_output,
|
||||||
struct log_msg2 *msg, uint32_t flags);
|
struct log_msg *msg, uint32_t flags);
|
||||||
|
|
||||||
/** @brief Process log messages v2 to SYS-T format.
|
/** @brief Process log messages v2 to SYS-T format.
|
||||||
*
|
*
|
||||||
|
@ -139,8 +139,8 @@ void log_output_msg2_process(const struct log_output *log_output,
|
||||||
* @param msg Log message.
|
* @param msg Log message.
|
||||||
* @param flag Optional flags.
|
* @param flag Optional flags.
|
||||||
*/
|
*/
|
||||||
void log_output_msg2_syst_process(const struct log_output *log_output,
|
void log_output_msg_syst_process(const struct log_output *log_output,
|
||||||
struct log_msg2 *msg, uint32_t flag);
|
struct log_msg *msg, uint32_t flag);
|
||||||
|
|
||||||
/** @brief Process dropped messages indication.
|
/** @brief Process dropped messages indication.
|
||||||
*
|
*
|
||||||
|
|
|
@ -56,8 +56,8 @@ struct log_dict_output_dropped_msg_t {
|
||||||
* @param msg Log message.
|
* @param msg Log message.
|
||||||
* @param flags Optional flags.
|
* @param flags Optional flags.
|
||||||
*/
|
*/
|
||||||
void log_dict_output_msg2_process(const struct log_output *log_output,
|
void log_dict_output_msg_process(const struct log_output *log_output,
|
||||||
struct log_msg2 *msg, uint32_t flags);
|
struct log_msg *msg, uint32_t flags);
|
||||||
|
|
||||||
/** @brief Process dropped messages indication for dictionary-based logging.
|
/** @brief Process dropped messages indication for dictionary-based logging.
|
||||||
*
|
*
|
||||||
|
|
|
@ -77,7 +77,7 @@ int z_shell_log_backend_output_func(uint8_t *data, size_t length, void *ctx);
|
||||||
.buf = _name##_buf, \
|
.buf = _name##_buf, \
|
||||||
.size = ARRAY_SIZE(_name##_buf), \
|
.size = ARRAY_SIZE(_name##_buf), \
|
||||||
.notify_drop = NULL, \
|
.notify_drop = NULL, \
|
||||||
.get_wlen = log_msg2_generic_get_wlen, \
|
.get_wlen = log_msg_generic_get_wlen, \
|
||||||
.flags = MPSC_PBUF_MODE_OVERWRITE, \
|
.flags = MPSC_PBUF_MODE_OVERWRITE, \
|
||||||
}; \
|
}; \
|
||||||
struct mpsc_pbuf_buffer _name##_mpsc_buffer; \
|
struct mpsc_pbuf_buffer _name##_mpsc_buffer; \
|
||||||
|
|
|
@ -207,7 +207,7 @@ static void performance_showcase(void)
|
||||||
{
|
{
|
||||||
/* Arbitrary limit when LOG_MODE_IMMEDIATE is enabled. */
|
/* Arbitrary limit when LOG_MODE_IMMEDIATE is enabled. */
|
||||||
#define LOG_IMMEDIATE_TEST_MESSAGES_LIMIT 50
|
#define LOG_IMMEDIATE_TEST_MESSAGES_LIMIT 50
|
||||||
#define MSG_SIZE (sizeof(struct log_msg2) + 2 * sizeof(void *) + sizeof(int))
|
#define MSG_SIZE (sizeof(struct log_msg) + 2 * sizeof(void *) + sizeof(int))
|
||||||
|
|
||||||
volatile uint32_t current_timestamp;
|
volatile uint32_t current_timestamp;
|
||||||
volatile uint32_t start_timestamp;
|
volatile uint32_t start_timestamp;
|
||||||
|
|
|
@ -311,7 +311,7 @@ static inline uint8_t monitor_priority_get(uint8_t log_level)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monitor_log_process(const struct log_backend *const backend,
|
static void monitor_log_process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
struct bt_monitor_user_logging user_log;
|
struct bt_monitor_user_logging user_log;
|
||||||
struct monitor_log_ctx ctx;
|
struct monitor_log_ctx ctx;
|
||||||
|
@ -321,7 +321,7 @@ static void monitor_log_process(const struct log_backend *const backend,
|
||||||
log_output_ctx_set(&monitor_log_output, &ctx);
|
log_output_ctx_set(&monitor_log_output, &ctx);
|
||||||
|
|
||||||
ctx.total_len = 0;
|
ctx.total_len = 0;
|
||||||
log_output_msg2_process(&monitor_log_output, &msg->log,
|
log_output_msg_process(&monitor_log_output, &msg->log,
|
||||||
LOG_OUTPUT_FLAG_CRLF_NONE);
|
LOG_OUTPUT_FLAG_CRLF_NONE);
|
||||||
|
|
||||||
if (atomic_test_and_set_bit(&flags, BT_LOG_BUSY)) {
|
if (atomic_test_and_set_bit(&flags, BT_LOG_BUSY)) {
|
||||||
|
@ -329,11 +329,11 @@ static void monitor_log_process(const struct log_backend *const backend,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
encode_hdr(&hdr, (uint32_t)log_msg2_get_timestamp(&msg->log),
|
encode_hdr(&hdr, (uint32_t)log_msg_get_timestamp(&msg->log),
|
||||||
BT_MONITOR_USER_LOGGING,
|
BT_MONITOR_USER_LOGGING,
|
||||||
sizeof(user_log) + sizeof(id) + ctx.total_len + 1);
|
sizeof(user_log) + sizeof(id) + ctx.total_len + 1);
|
||||||
|
|
||||||
user_log.priority = monitor_priority_get(log_msg2_get_level(&msg->log));
|
user_log.priority = monitor_priority_get(log_msg_get_level(&msg->log));
|
||||||
user_log.ident_len = sizeof(id);
|
user_log.ident_len = sizeof(id);
|
||||||
|
|
||||||
monitor_send(&hdr, BT_MONITOR_BASE_HDR_LEN + hdr.hdr_len);
|
monitor_send(&hdr, BT_MONITOR_BASE_HDR_LEN + hdr.hdr_len);
|
||||||
|
|
|
@ -15,15 +15,15 @@ if(NOT CONFIG_LOG_MODE_MINIMAL)
|
||||||
# - C++ (auto)
|
# - C++ (auto)
|
||||||
# - GCC 4.9.0 https://gcc.gnu.org/gcc-4.9/changes.html
|
# - GCC 4.9.0 https://gcc.gnu.org/gcc-4.9/changes.html
|
||||||
# - Clang 3.8
|
# - Clang 3.8
|
||||||
if (NOT CONFIG_LOG2_ALWAYS_RUNTIME)
|
if (NOT CONFIG_LOG_ALWAYS_RUNTIME)
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
if(CMAKE_C_COMPILER_VERSION VERSION_LESS "3.8.0")
|
if(CMAKE_C_COMPILER_VERSION VERSION_LESS "3.8.0")
|
||||||
message(WARNING "Compiler version requires CONFIG_LOG2_ALWAYS_RUNTIME to be set")
|
message(WARNING "Compiler version requires CONFIG_LOG_ALWAYS_RUNTIME to be set")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
if(CMAKE_C_COMPILER_VERSION VERSION_LESS "4.9.0")
|
if(CMAKE_C_COMPILER_VERSION VERSION_LESS "4.9.0")
|
||||||
message(WARNING "Compiler version requires CONFIG_LOG2_ALWAYS_RUNTIME to be set")
|
message(WARNING "Compiler version requires CONFIG_LOG_ALWAYS_RUNTIME to be set")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -31,8 +31,8 @@ if LOG_MIPI_SYST_ENABLE
|
||||||
|
|
||||||
config LOG_MIPI_SYST_USE_CATALOG
|
config LOG_MIPI_SYST_USE_CATALOG
|
||||||
bool "Use MIPI Sys-T Catalog for logging"
|
bool "Use MIPI Sys-T Catalog for logging"
|
||||||
select LOG2_FMT_SECTION
|
select LOG_FMT_SECTION
|
||||||
select LOG2_USE_TAGGED_ARGUMENTS
|
select LOG_USE_TAGGED_ARGUMENTS
|
||||||
help
|
help
|
||||||
Use MIPI Sys-T Catalog for logging instead of plain text.
|
Use MIPI Sys-T Catalog for logging instead of plain text.
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ config LOG_TEST_CLEAR_MESSAGE_SPACE
|
||||||
Used in testing to simplify message comparision if message contains
|
Used in testing to simplify message comparision if message contains
|
||||||
paddings.
|
paddings.
|
||||||
|
|
||||||
config LOG2_USE_VLA
|
config LOG_USE_VLA
|
||||||
bool "Using variable length arrays"
|
bool "Using variable length arrays"
|
||||||
default y if !MISRA_SANE
|
default y if !MISRA_SANE
|
||||||
help
|
help
|
||||||
|
@ -33,7 +33,7 @@ config LOG2_USE_VLA
|
||||||
supported. Note that VLA are used for arrays which size is resolved at
|
supported. Note that VLA are used for arrays which size is resolved at
|
||||||
compile time so at runtime arrays have fixed size.
|
compile time so at runtime arrays have fixed size.
|
||||||
|
|
||||||
config LOG2_ALWAYS_RUNTIME
|
config LOG_ALWAYS_RUNTIME
|
||||||
bool "Always use runtime message creation (v2)"
|
bool "Always use runtime message creation (v2)"
|
||||||
default y if NO_OPTIMIZATIONS
|
default y if NO_OPTIMIZATIONS
|
||||||
default y if LOG_MODE_IMMEDIATE
|
default y if LOG_MODE_IMMEDIATE
|
||||||
|
@ -48,17 +48,17 @@ config LOG2_ALWAYS_RUNTIME
|
||||||
less stack than static message creation and speed has lower priority
|
less stack than static message creation and speed has lower priority
|
||||||
in that mode.
|
in that mode.
|
||||||
|
|
||||||
config LOG2_FMT_SECTION
|
config LOG_FMT_SECTION
|
||||||
bool "Keep log strings in dedicated section"
|
bool "Keep log strings in dedicated section"
|
||||||
help
|
help
|
||||||
When enabled, logs are kept in dedicated memory section. It allows
|
When enabled, logs are kept in dedicated memory section. It allows
|
||||||
removing strings from final binary and should be used for dictionary
|
removing strings from final binary and should be used for dictionary
|
||||||
logging.
|
logging.
|
||||||
|
|
||||||
config LOG2_USE_TAGGED_ARGUMENTS
|
config LOG_USE_TAGGED_ARGUMENTS
|
||||||
bool "Using tagged arguments for packaging"
|
bool "Using tagged arguments for packaging"
|
||||||
select CBPRINTF_PACKAGE_SUPPORT_TAGGED_ARGUMENTS
|
select CBPRINTF_PACKAGE_SUPPORT_TAGGED_ARGUMENTS
|
||||||
select LOG2_ALWAYS_RUNTIME
|
select LOG_ALWAYS_RUNTIME
|
||||||
help
|
help
|
||||||
If enabled, packaging uses tagged arguments.
|
If enabled, packaging uses tagged arguments.
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ static inline void dropped(const struct log_backend *const backend,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
log_format_func_t log_output_func = log_format_func_t_get(log_format_current);
|
log_format_func_t log_output_func = log_format_func_t_get(log_format_current);
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ static uint32_t format_flags(void)
|
||||||
static volatile uint32_t counter;
|
static volatile uint32_t counter;
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(backend);
|
ARG_UNUSED(backend);
|
||||||
|
|
||||||
|
|
|
@ -458,7 +458,7 @@ static void dropped(const struct log_backend *const backend, uint32_t cnt)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags = log_backend_std_get_flags();
|
uint32_t flags = log_backend_std_get_flags();
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void dropped(const struct log_backend *const backend, uint32_t cnt)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags = log_backend_std_get_flags();
|
uint32_t flags = log_backend_std_get_flags();
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ static int do_net_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags = LOG_OUTPUT_FLAG_FORMAT_SYSLOG | LOG_OUTPUT_FLAG_TIMESTAMP;
|
uint32_t flags = LOG_OUTPUT_FLAG_FORMAT_SYSLOG | LOG_OUTPUT_FLAG_TIMESTAMP;
|
||||||
|
|
||||||
|
|
|
@ -285,7 +285,7 @@ static void dropped(const struct log_backend *const backend, uint32_t cnt)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags = log_backend_std_get_flags();
|
uint32_t flags = log_backend_std_get_flags();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ static inline bool is_panic_mode(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
/* prevent adding CRLF, which may crash spinel decoding */
|
/* prevent adding CRLF, which may crash spinel decoding */
|
||||||
uint32_t flags = LOG_OUTPUT_FLAG_CRLF_NONE | log_backend_std_get_flags();
|
uint32_t flags = LOG_OUTPUT_FLAG_CRLF_NONE | log_backend_std_get_flags();
|
||||||
|
|
|
@ -74,7 +74,7 @@ static int char_out(uint8_t *data, size_t length, void *ctx)
|
||||||
LOG_OUTPUT_DEFINE(log_output_swo, char_out, buf, sizeof(buf));
|
LOG_OUTPUT_DEFINE(log_output_swo, char_out, buf, sizeof(buf));
|
||||||
|
|
||||||
static void log_backend_swo_process(const struct log_backend *const backend,
|
static void log_backend_swo_process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags = log_backend_std_get_flags();
|
uint32_t flags = log_backend_std_get_flags();
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ static uint8_t uart_output_buf[CONFIG_LOG_BACKEND_UART_BUFFER_SIZE];
|
||||||
LOG_OUTPUT_DEFINE(log_output_uart, char_out, uart_output_buf, sizeof(uart_output_buf));
|
LOG_OUTPUT_DEFINE(log_output_uart, char_out, uart_output_buf, sizeof(uart_output_buf));
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags = log_backend_std_get_flags();
|
uint32_t flags = log_backend_std_get_flags();
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ LOG_OUTPUT_DEFINE(log_output_xsim, char_out,
|
||||||
xtensa_log_buf, sizeof(xtensa_log_buf));
|
xtensa_log_buf, sizeof(xtensa_log_buf));
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags = log_backend_std_get_flags();
|
uint32_t flags = log_backend_std_get_flags();
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ LOG_MODULE_REGISTER(log);
|
||||||
#define CONFIG_LOG_TAG_MAX_LEN 0
|
#define CONFIG_LOG_TAG_MAX_LEN 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_LOG2_ALWAYS_RUNTIME
|
#ifndef CONFIG_LOG_ALWAYS_RUNTIME
|
||||||
BUILD_ASSERT(!IS_ENABLED(CONFIG_NO_OPTIMIZATIONS),
|
BUILD_ASSERT(!IS_ENABLED(CONFIG_NO_OPTIMIZATIONS),
|
||||||
"Option must be enabled when CONFIG_NO_OPTIMIZATIONS is set");
|
"Option must be enabled when CONFIG_NO_OPTIMIZATIONS is set");
|
||||||
BUILD_ASSERT(!IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE),
|
BUILD_ASSERT(!IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE),
|
||||||
|
@ -54,11 +54,11 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const log_format_func_t format_table[] = {
|
static const log_format_func_t format_table[] = {
|
||||||
[LOG_OUTPUT_TEXT] = log_output_msg2_process,
|
[LOG_OUTPUT_TEXT] = log_output_msg_process,
|
||||||
[LOG_OUTPUT_SYST] = IS_ENABLED(CONFIG_LOG_MIPI_SYST_ENABLE) ?
|
[LOG_OUTPUT_SYST] = IS_ENABLED(CONFIG_LOG_MIPI_SYST_ENABLE) ?
|
||||||
log_output_msg2_syst_process : NULL,
|
log_output_msg_syst_process : NULL,
|
||||||
[LOG_OUTPUT_DICT] = IS_ENABLED(CONFIG_LOG_DICTIONARY_SUPPORT) ?
|
[LOG_OUTPUT_DICT] = IS_ENABLED(CONFIG_LOG_DICTIONARY_SUPPORT) ?
|
||||||
log_dict_output_msg2_process : NULL
|
log_dict_output_msg_process : NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
log_format_func_t log_format_func_t_get(uint32_t log_type)
|
log_format_func_t log_format_func_t_get(uint32_t log_type)
|
||||||
|
@ -71,12 +71,6 @@ size_t log_format_table_size(void)
|
||||||
return ARRAY_SIZE(format_table);
|
return ARRAY_SIZE(format_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
union log_msgs {
|
|
||||||
struct log_msg *msg;
|
|
||||||
union log_msg2_generic *msg2;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
K_SEM_DEFINE(log_process_thread_sem, 0, 1);
|
K_SEM_DEFINE(log_process_thread_sem, 0, 1);
|
||||||
|
|
||||||
static atomic_t initialized;
|
static atomic_t initialized;
|
||||||
|
@ -101,7 +95,7 @@ static const struct mpsc_pbuf_buffer_config mpsc_config = {
|
||||||
.buf = (uint32_t *)buf32,
|
.buf = (uint32_t *)buf32,
|
||||||
.size = ARRAY_SIZE(buf32),
|
.size = ARRAY_SIZE(buf32),
|
||||||
.notify_drop = notify_drop,
|
.notify_drop = notify_drop,
|
||||||
.get_wlen = log_msg2_generic_get_wlen,
|
.get_wlen = log_msg_generic_get_wlen,
|
||||||
.flags = (IS_ENABLED(CONFIG_LOG_MODE_OVERFLOW) ?
|
.flags = (IS_ENABLED(CONFIG_LOG_MODE_OVERFLOW) ?
|
||||||
MPSC_PBUF_MODE_OVERWRITE : 0) |
|
MPSC_PBUF_MODE_OVERWRITE : 0) |
|
||||||
(IS_ENABLED(CONFIG_LOG_MEM_UTILIZATION) ?
|
(IS_ENABLED(CONFIG_LOG_MEM_UTILIZATION) ?
|
||||||
|
@ -116,7 +110,7 @@ COND_CODE_0(CONFIG_LOG_TAG_MAX_LEN, (),
|
||||||
static char tag[CONFIG_LOG_TAG_MAX_LEN + 1] =
|
static char tag[CONFIG_LOG_TAG_MAX_LEN + 1] =
|
||||||
COND_CODE_0(CONFIG_LOG_TAG_MAX_LEN, ({}), (CONFIG_LOG_TAG_DEFAULT));
|
COND_CODE_0(CONFIG_LOG_TAG_MAX_LEN, ({}), (CONFIG_LOG_TAG_DEFAULT));
|
||||||
|
|
||||||
static void msg_process(union log_msg2_generic *msg);
|
static void msg_process(union log_msg_generic *msg);
|
||||||
|
|
||||||
static log_timestamp_t dummy_timestamp(void)
|
static log_timestamp_t dummy_timestamp(void)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +172,7 @@ void z_log_vprintk(const char *fmt, va_list ap)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
z_log_msg2_runtime_vcreate(CONFIG_LOG_DOMAIN_ID, NULL,
|
z_log_msg_runtime_vcreate(CONFIG_LOG_DOMAIN_ID, NULL,
|
||||||
LOG_LEVEL_INTERNAL_RAW_STRING, NULL, 0, 0,
|
LOG_LEVEL_INTERNAL_RAW_STRING, NULL, 0, 0,
|
||||||
fmt, ap);
|
fmt, ap);
|
||||||
}
|
}
|
||||||
|
@ -215,7 +209,7 @@ void log_core_init(void)
|
||||||
log_set_timestamp_func(_timestamp_func, freq);
|
log_set_timestamp_func(_timestamp_func, freq);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
||||||
z_log_msg2_init();
|
z_log_msg_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING)) {
|
if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING)) {
|
||||||
|
@ -375,7 +369,7 @@ void z_vrfy_log_panic(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool msg_filter_check(struct log_backend const *backend,
|
static bool msg_filter_check(struct log_backend const *backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
if (!z_log_item_is_msg(msg)) {
|
if (!z_log_item_is_msg(msg)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -391,9 +385,9 @@ static bool msg_filter_check(struct log_backend const *backend,
|
||||||
int16_t source_id;
|
int16_t source_id;
|
||||||
struct log_source_dynamic_data *source;
|
struct log_source_dynamic_data *source;
|
||||||
|
|
||||||
source = (struct log_source_dynamic_data *)log_msg2_get_source(&msg->log);
|
source = (struct log_source_dynamic_data *)log_msg_get_source(&msg->log);
|
||||||
level = log_msg2_get_level(&msg->log);
|
level = log_msg_get_level(&msg->log);
|
||||||
domain_id = log_msg2_get_domain(&msg->log);
|
domain_id = log_msg_get_domain(&msg->log);
|
||||||
source_id = source ? log_dynamic_source_id(source) : -1;
|
source_id = source ? log_dynamic_source_id(source) : -1;
|
||||||
|
|
||||||
backend_level = log_filter_get(backend, domain_id,
|
backend_level = log_filter_get(backend, domain_id,
|
||||||
|
@ -402,7 +396,7 @@ static bool msg_filter_check(struct log_backend const *backend,
|
||||||
return (level <= backend_level);
|
return (level <= backend_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void msg_process(union log_msg2_generic *msg)
|
static void msg_process(union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
struct log_backend const *backend;
|
struct log_backend const *backend;
|
||||||
|
|
||||||
|
@ -410,7 +404,7 @@ static void msg_process(union log_msg2_generic *msg)
|
||||||
backend = log_backend_get(i);
|
backend = log_backend_get(i);
|
||||||
if (log_backend_is_active(backend) &&
|
if (log_backend_is_active(backend) &&
|
||||||
msg_filter_check(backend, msg)) {
|
msg_filter_check(backend, msg)) {
|
||||||
log_backend_msg2_process(backend, msg);
|
log_backend_msg_process(backend, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -446,24 +440,24 @@ bool z_impl_log_process(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
union log_msg2_generic *msg;
|
union log_msg_generic *msg;
|
||||||
|
|
||||||
if (!backend_attached) {
|
if (!backend_attached) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = z_log_msg2_claim();
|
msg = z_log_msg_claim();
|
||||||
if (msg) {
|
if (msg) {
|
||||||
atomic_dec(&buffered_cnt);
|
atomic_dec(&buffered_cnt);
|
||||||
msg_process(msg);
|
msg_process(msg);
|
||||||
z_log_msg2_free(msg);
|
z_log_msg_free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (z_log_dropped_pending()) {
|
if (z_log_dropped_pending()) {
|
||||||
dropped_notify();
|
dropped_notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
return z_log_msg2_pending();
|
return z_log_msg_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
|
@ -514,24 +508,24 @@ static void notify_drop(const struct mpsc_pbuf_buffer *buffer,
|
||||||
z_log_dropped(true);
|
z_log_dropped(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_log_msg2_init(void)
|
void z_log_msg_init(void)
|
||||||
{
|
{
|
||||||
mpsc_pbuf_init(&log_buffer, &mpsc_config);
|
mpsc_pbuf_init(&log_buffer, &mpsc_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct log_msg2 *z_log_msg2_alloc(uint32_t wlen)
|
struct log_msg *z_log_msg_alloc(uint32_t wlen)
|
||||||
{
|
{
|
||||||
if (!IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
if (!IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (struct log_msg2 *)mpsc_pbuf_alloc(&log_buffer, wlen,
|
return (struct log_msg *)mpsc_pbuf_alloc(&log_buffer, wlen,
|
||||||
K_MSEC(CONFIG_LOG_BLOCK_IN_THREAD_TIMEOUT_MS));
|
K_MSEC(CONFIG_LOG_BLOCK_IN_THREAD_TIMEOUT_MS));
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_log_msg2_commit(struct log_msg2 *msg)
|
void z_log_msg_commit(struct log_msg *msg)
|
||||||
{
|
{
|
||||||
union log_msg2_generic *m = (union log_msg2_generic *)msg;
|
union log_msg_generic *m = (union log_msg_generic *)msg;
|
||||||
|
|
||||||
msg->hdr.timestamp = timestamp_func();
|
msg->hdr.timestamp = timestamp_func();
|
||||||
|
|
||||||
|
@ -545,17 +539,17 @@ void z_log_msg2_commit(struct log_msg2 *msg)
|
||||||
z_log_msg_post_finalize();
|
z_log_msg_post_finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
union log_msg2_generic *z_log_msg2_claim(void)
|
union log_msg_generic *z_log_msg_claim(void)
|
||||||
{
|
{
|
||||||
return (union log_msg2_generic *)mpsc_pbuf_claim(&log_buffer);
|
return (union log_msg_generic *)mpsc_pbuf_claim(&log_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_log_msg2_free(union log_msg2_generic *msg)
|
void z_log_msg_free(union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
mpsc_pbuf_free(&log_buffer, (union mpsc_pbuf_generic *)msg);
|
mpsc_pbuf_free(&log_buffer, (union mpsc_pbuf_generic *)msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool z_log_msg2_pending(void)
|
bool z_log_msg_pending(void)
|
||||||
{
|
{
|
||||||
return mpsc_pbuf_is_pending(&log_buffer);
|
return mpsc_pbuf_is_pending(&log_buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ static void uart_isr_callback(const struct device *dev, void *user_data)
|
||||||
|
|
||||||
static inline void hdr_fill(struct log_dict_output_normal_msg_hdr_t *hdr,
|
static inline void hdr_fill(struct log_dict_output_normal_msg_hdr_t *hdr,
|
||||||
const void *source,
|
const void *source,
|
||||||
const struct log_msg2_desc desc)
|
const struct log_msg_desc desc)
|
||||||
{
|
{
|
||||||
hdr->type = MSG_NORMAL;
|
hdr->type = MSG_NORMAL;
|
||||||
hdr->domain = desc.domain;
|
hdr->domain = desc.domain;
|
||||||
|
@ -242,7 +242,7 @@ static inline void hdr_fill(struct log_dict_output_normal_msg_hdr_t *hdr,
|
||||||
|
|
||||||
/* Handle logging message in synchronous manner, in panic mode. */
|
/* Handle logging message in synchronous manner, in panic mode. */
|
||||||
static void sync_msg(const void *source,
|
static void sync_msg(const void *source,
|
||||||
const struct log_msg2_desc desc,
|
const struct log_msg_desc desc,
|
||||||
uint8_t *package, const void *data)
|
uint8_t *package, const void *data)
|
||||||
{
|
{
|
||||||
struct log_dict_output_normal_msg_hdr_t hdr;
|
struct log_dict_output_normal_msg_hdr_t hdr;
|
||||||
|
@ -259,11 +259,11 @@ static void sync_msg(const void *source,
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_frontend_msg(const void *source,
|
void log_frontend_msg(const void *source,
|
||||||
const struct log_msg2_desc desc,
|
const struct log_msg_desc desc,
|
||||||
uint8_t *package, const void *data)
|
uint8_t *package, const void *data)
|
||||||
{
|
{
|
||||||
uint16_t strl[4];
|
uint16_t strl[4];
|
||||||
struct log_msg2_desc outdesc = desc;
|
struct log_msg_desc outdesc = desc;
|
||||||
int plen = cbprintf_package_copy(package, desc.package_len, NULL, 0,
|
int plen = cbprintf_package_copy(package, desc.package_len, NULL, 0,
|
||||||
CBPRINTF_PACKAGE_COPY_RW_STR,
|
CBPRINTF_PACKAGE_COPY_RW_STR,
|
||||||
strl, ARRAY_SIZE(strl));
|
strl, ARRAY_SIZE(strl));
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
!(IS_ENABLED(CONFIG_LOG_FRONTEND) && \
|
!(IS_ENABLED(CONFIG_LOG_FRONTEND) && \
|
||||||
(IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY) || log_backend_count_get() == 0))
|
(IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY) || log_backend_count_get() == 0))
|
||||||
|
|
||||||
void z_log_msg2_finalize(struct log_msg2 *msg, const void *source,
|
void z_log_msg_finalize(struct log_msg *msg, const void *source,
|
||||||
const struct log_msg2_desc desc, const void *data)
|
const struct log_msg_desc desc, const void *data)
|
||||||
{
|
{
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
z_log_dropped(false);
|
z_log_dropped(false);
|
||||||
|
@ -32,11 +32,11 @@ void z_log_msg2_finalize(struct log_msg2 *msg, const void *source,
|
||||||
|
|
||||||
msg->hdr.desc = desc;
|
msg->hdr.desc = desc;
|
||||||
msg->hdr.source = source;
|
msg->hdr.source = source;
|
||||||
z_log_msg2_commit(msg);
|
z_log_msg_commit(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_impl_z_log_msg2_static_create(const void *source,
|
void z_impl_z_log_msg_static_create(const void *source,
|
||||||
const struct log_msg2_desc desc,
|
const struct log_msg_desc desc,
|
||||||
uint8_t *package, const void *data)
|
uint8_t *package, const void *data)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND)) {
|
if (IS_ENABLED(CONFIG_LOG_FRONTEND)) {
|
||||||
|
@ -47,9 +47,9 @@ void z_impl_z_log_msg2_static_create(const void *source,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct log_msg2_desc out_desc = desc;
|
struct log_msg_desc out_desc = desc;
|
||||||
int inlen = desc.package_len;
|
int inlen = desc.package_len;
|
||||||
struct log_msg2 *msg;
|
struct log_msg *msg;
|
||||||
|
|
||||||
if (inlen > 0) {
|
if (inlen > 0) {
|
||||||
uint32_t flags = CBPRINTF_PACKAGE_COPY_RW_STR;
|
uint32_t flags = CBPRINTF_PACKAGE_COPY_RW_STR;
|
||||||
|
@ -64,7 +64,7 @@ void z_impl_z_log_msg2_static_create(const void *source,
|
||||||
* when strings are copied into the package.
|
* when strings are copied into the package.
|
||||||
*/
|
*/
|
||||||
out_desc.package_len = len;
|
out_desc.package_len = len;
|
||||||
msg = z_log_msg2_alloc(log_msg2_get_total_wlen(out_desc));
|
msg = z_log_msg_alloc(log_msg_get_total_wlen(out_desc));
|
||||||
if (msg) {
|
if (msg) {
|
||||||
len = cbprintf_package_copy(package, inlen,
|
len = cbprintf_package_copy(package, inlen,
|
||||||
msg->data, out_desc.package_len,
|
msg->data, out_desc.package_len,
|
||||||
|
@ -72,23 +72,23 @@ void z_impl_z_log_msg2_static_create(const void *source,
|
||||||
__ASSERT_NO_MSG(len >= 0);
|
__ASSERT_NO_MSG(len >= 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg = z_log_msg2_alloc(log_msg2_get_total_wlen(out_desc));
|
msg = z_log_msg_alloc(log_msg_get_total_wlen(out_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
z_log_msg2_finalize(msg, source, out_desc, data);
|
z_log_msg_finalize(msg, source, out_desc, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
static inline void z_vrfy_z_log_msg2_static_create(const void *source,
|
static inline void z_vrfy_z_log_msg_static_create(const void *source,
|
||||||
const struct log_msg2_desc desc,
|
const struct log_msg_desc desc,
|
||||||
uint8_t *package, const void *data)
|
uint8_t *package, const void *data)
|
||||||
{
|
{
|
||||||
return z_impl_z_log_msg2_static_create(source, desc, package, data);
|
return z_impl_z_log_msg_static_create(source, desc, package, data);
|
||||||
}
|
}
|
||||||
#include <syscalls/z_log_msg2_static_create_mrsh.c>
|
#include <syscalls/z_log_msg_static_create_mrsh.c>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void z_impl_z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
void z_impl_z_log_msg_runtime_vcreate(uint8_t domain_id, const void *source,
|
||||||
uint8_t level, const void *data, size_t dlen,
|
uint8_t level, const void *data, size_t dlen,
|
||||||
uint32_t package_flags, const char *fmt, va_list ap)
|
uint32_t package_flags, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
|
@ -107,13 +107,13 @@ void z_impl_z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t msg_wlen = Z_LOG_MSG2_ALIGNED_WLEN(plen, dlen);
|
size_t msg_wlen = Z_LOG_MSG2_ALIGNED_WLEN(plen, dlen);
|
||||||
struct log_msg2 *msg;
|
struct log_msg *msg;
|
||||||
uint8_t *pkg;
|
uint8_t *pkg;
|
||||||
struct log_msg2_desc desc =
|
struct log_msg_desc desc =
|
||||||
Z_LOG_MSG_DESC_INITIALIZER(domain_id, level, plen, dlen);
|
Z_LOG_MSG_DESC_INITIALIZER(domain_id, level, plen, dlen);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED) && BACKENDS_IN_USE()) {
|
if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED) && BACKENDS_IN_USE()) {
|
||||||
msg = z_log_msg2_alloc(msg_wlen);
|
msg = z_log_msg_alloc(msg_wlen);
|
||||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND) && msg == NULL) {
|
if (IS_ENABLED(CONFIG_LOG_FRONTEND) && msg == NULL) {
|
||||||
pkg = alloca(plen);
|
pkg = alloca(plen);
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,18 +134,18 @@ void z_impl_z_log_msg2_runtime_vcreate(uint8_t domain_id, const void *source,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BACKENDS_IN_USE()) {
|
if (BACKENDS_IN_USE()) {
|
||||||
z_log_msg2_finalize(msg, source, desc, data);
|
z_log_msg_finalize(msg, source, desc, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
static inline void z_vrfy_z_log_msg2_runtime_vcreate(uint8_t domain_id,
|
static inline void z_vrfy_z_log_msg_runtime_vcreate(uint8_t domain_id,
|
||||||
const void *source,
|
const void *source,
|
||||||
uint8_t level, const void *data, size_t dlen,
|
uint8_t level, const void *data, size_t dlen,
|
||||||
uint32_t package_flags, const char *fmt, va_list ap)
|
uint32_t package_flags, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
return z_impl_z_log_msg2_runtime_vcreate(domain_id, source, level, data,
|
return z_impl_z_log_msg_runtime_vcreate(domain_id, source, level, data,
|
||||||
dlen, package_flags, fmt, ap);
|
dlen, package_flags, fmt, ap);
|
||||||
}
|
}
|
||||||
#include <syscalls/z_log_msg2_runtime_vcreate_mrsh.c>
|
#include <syscalls/z_log_msg_runtime_vcreate_mrsh.c>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -57,9 +57,6 @@ struct YMD_date {
|
||||||
uint32_t day;
|
uint32_t day;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void log_output_msg2_syst_process(const struct log_output *output,
|
|
||||||
struct log_msg2 *msg, uint32_t flag);
|
|
||||||
|
|
||||||
/* The RFC 5424 allows very flexible mapping and suggest the value 0 being the
|
/* The RFC 5424 allows very flexible mapping and suggest the value 0 being the
|
||||||
* highest severity and 7 to be the lowest (debugging level) severity.
|
* highest severity and 7 to be the lowest (debugging level) severity.
|
||||||
*
|
*
|
||||||
|
@ -396,7 +393,7 @@ static void hexdump_line_print(const struct log_output *output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_msg2_hexdump(const struct log_output *output,
|
static void log_msg_hexdump(const struct log_output *output,
|
||||||
uint8_t *data, uint32_t len,
|
uint8_t *data, uint32_t len,
|
||||||
int prefix_offset, uint32_t flags)
|
int prefix_offset, uint32_t flags)
|
||||||
{
|
{
|
||||||
|
@ -473,17 +470,17 @@ static void postfix_print(const struct log_output *output,
|
||||||
newline_print(output, flags);
|
newline_print(output, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_output_msg2_process(const struct log_output *output,
|
void log_output_msg_process(const struct log_output *output,
|
||||||
struct log_msg2 *msg, uint32_t flags)
|
struct log_msg *msg, uint32_t flags)
|
||||||
{
|
{
|
||||||
log_timestamp_t timestamp = log_msg2_get_timestamp(msg);
|
log_timestamp_t timestamp = log_msg_get_timestamp(msg);
|
||||||
uint8_t level = log_msg2_get_level(msg);
|
uint8_t level = log_msg_get_level(msg);
|
||||||
bool raw_string = (level == LOG_LEVEL_INTERNAL_RAW_STRING);
|
bool raw_string = (level == LOG_LEVEL_INTERNAL_RAW_STRING);
|
||||||
uint32_t prefix_offset;
|
uint32_t prefix_offset;
|
||||||
|
|
||||||
if (!raw_string) {
|
if (!raw_string) {
|
||||||
void *source = (void *)log_msg2_get_source(msg);
|
void *source = (void *)log_msg_get_source(msg);
|
||||||
uint8_t domain_id = log_msg2_get_domain(msg);
|
uint8_t domain_id = log_msg_get_domain(msg);
|
||||||
int16_t source_id = source ?
|
int16_t source_id = source ?
|
||||||
(IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ?
|
(IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ?
|
||||||
log_dynamic_source_id(source) :
|
log_dynamic_source_id(source) :
|
||||||
|
@ -497,7 +494,7 @@ void log_output_msg2_process(const struct log_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len;
|
size_t len;
|
||||||
uint8_t *data = log_msg2_get_package(msg, &len);
|
uint8_t *data = log_msg_get_package(msg, &len);
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
int err = cbpprintf(raw_string ? cr_out_func : out_func,
|
int err = cbpprintf(raw_string ? cr_out_func : out_func,
|
||||||
|
@ -507,9 +504,9 @@ void log_output_msg2_process(const struct log_output *output,
|
||||||
__ASSERT_NO_MSG(err >= 0);
|
__ASSERT_NO_MSG(err >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
data = log_msg2_get_data(msg, &len);
|
data = log_msg_get_data(msg, &len);
|
||||||
if (len) {
|
if (len) {
|
||||||
log_msg2_hexdump(output, data, len, prefix_offset, flags);
|
log_msg_hexdump(output, data, len, prefix_offset, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!raw_string) {
|
if (!raw_string) {
|
||||||
|
|
|
@ -24,13 +24,13 @@ static void buffer_write(log_output_func_t outf, uint8_t *buf, size_t len,
|
||||||
} while (len != 0);
|
} while (len != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_dict_output_msg2_process(const struct log_output *output,
|
void log_dict_output_msg_process(const struct log_output *output,
|
||||||
struct log_msg2 *msg, uint32_t flags)
|
struct log_msg *msg, uint32_t flags)
|
||||||
{
|
{
|
||||||
struct log_dict_output_normal_msg_hdr_t output_hdr;
|
struct log_dict_output_normal_msg_hdr_t output_hdr;
|
||||||
void *source = (void *)log_msg2_get_source(msg);
|
void *source = (void *)log_msg_get_source(msg);
|
||||||
|
|
||||||
/* Keep sync with header in struct log_msg2 */
|
/* Keep sync with header in struct log_msg */
|
||||||
output_hdr.type = MSG_NORMAL;
|
output_hdr.type = MSG_NORMAL;
|
||||||
output_hdr.domain = msg->hdr.desc.domain;
|
output_hdr.domain = msg->hdr.desc.domain;
|
||||||
output_hdr.level = msg->hdr.desc.level;
|
output_hdr.level = msg->hdr.desc.level;
|
||||||
|
@ -48,13 +48,13 @@ void log_dict_output_msg2_process(const struct log_output *output,
|
||||||
(void *)output);
|
(void *)output);
|
||||||
|
|
||||||
size_t len;
|
size_t len;
|
||||||
uint8_t *data = log_msg2_get_package(msg, &len);
|
uint8_t *data = log_msg_get_package(msg, &len);
|
||||||
|
|
||||||
if (len > 0U) {
|
if (len > 0U) {
|
||||||
buffer_write(output->func, data, len, (void *)output);
|
buffer_write(output->func, data, len, (void *)output);
|
||||||
}
|
}
|
||||||
|
|
||||||
data = log_msg2_get_data(msg, &len);
|
data = log_msg_get_data(msg, &len);
|
||||||
if (len > 0U) {
|
if (len > 0U) {
|
||||||
buffer_write(output->func, data, len, (void *)output);
|
buffer_write(output->func, data, len, (void *)output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -611,8 +611,8 @@ static void hexdump2_print(const uint8_t *data, uint32_t length,
|
||||||
static int mipi_vprintf_formatter(cbprintf_cb out, void *ctx,
|
static int mipi_vprintf_formatter(cbprintf_cb out, void *ctx,
|
||||||
const char *fmt, va_list ap)
|
const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
struct log_msg2 *msg = ctx;
|
struct log_msg *msg = ctx;
|
||||||
uint32_t severity = level_to_syst_severity(log_msg2_get_level(msg));
|
uint32_t severity = level_to_syst_severity(log_msg_get_level(msg));
|
||||||
|
|
||||||
MIPI_SYST_VPRINTF(&log_syst_handle, severity, fmt, ap);
|
MIPI_SYST_VPRINTF(&log_syst_handle, severity, fmt, ap);
|
||||||
|
|
||||||
|
@ -647,8 +647,8 @@ static uint8_t payload_buf[CONFIG_LOG_MIPI_SYST_CATALOG_ARGS_BUFFER_SIZE];
|
||||||
static int mipi_catalog_formatter(cbprintf_cb out, void *ctx,
|
static int mipi_catalog_formatter(cbprintf_cb out, void *ctx,
|
||||||
const char *fmt, va_list ap)
|
const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
struct log_msg2 *msg = ctx;
|
struct log_msg *msg = ctx;
|
||||||
uint32_t severity = level_to_syst_severity(log_msg2_get_level(msg));
|
uint32_t severity = level_to_syst_severity(log_msg_get_level(msg));
|
||||||
k_spinlock_key_t key;
|
k_spinlock_key_t key;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
@ -778,21 +778,21 @@ no_space:
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_LOG_MIPI_SYST_USE_CATALOG */
|
#endif /* CONFIG_LOG_MIPI_SYST_USE_CATALOG */
|
||||||
|
|
||||||
void log_output_msg2_syst_process(const struct log_output *output,
|
void log_output_msg_syst_process(const struct log_output *output,
|
||||||
struct log_msg2 *msg, uint32_t flag)
|
struct log_msg *msg, uint32_t flag)
|
||||||
{
|
{
|
||||||
size_t len, hexdump_len;
|
size_t len, hexdump_len;
|
||||||
|
|
||||||
update_systh_platform_data(&log_syst_handle, output, flag);
|
update_systh_platform_data(&log_syst_handle, output, flag);
|
||||||
|
|
||||||
#ifdef CONFIG_LOG_MIPI_SYST_OUTPUT_LOG_MSG_SRC_ID
|
#ifdef CONFIG_LOG_MIPI_SYST_OUTPUT_LOG_MSG_SRC_ID
|
||||||
uint8_t level = log_msg2_get_level(msg);
|
uint8_t level = log_msg_get_level(msg);
|
||||||
bool raw_string = (level == LOG_LEVEL_INTERNAL_RAW_STRING);
|
bool raw_string = (level == LOG_LEVEL_INTERNAL_RAW_STRING);
|
||||||
int16_t source_id = CONFIG_LOG_MIPI_SYST_MSG_DEFAULT_MODULE_ID;
|
int16_t source_id = CONFIG_LOG_MIPI_SYST_MSG_DEFAULT_MODULE_ID;
|
||||||
|
|
||||||
/* Set the log source ID as Sys-T message module ID */
|
/* Set the log source ID as Sys-T message module ID */
|
||||||
if (!raw_string) {
|
if (!raw_string) {
|
||||||
void *source = (void *)log_msg2_get_source(msg);
|
void *source = (void *)log_msg_get_source(msg);
|
||||||
|
|
||||||
if (source != NULL) {
|
if (source != NULL) {
|
||||||
source_id = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ?
|
source_id = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ?
|
||||||
|
@ -804,7 +804,7 @@ void log_output_msg2_syst_process(const struct log_output *output,
|
||||||
update_handle_origin_unit(&log_syst_handle, source_id);
|
update_handle_origin_unit(&log_syst_handle, source_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t *data = log_msg2_get_package(msg, &len);
|
uint8_t *data = log_msg_get_package(msg, &len);
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
#ifdef CONFIG_LOG_MIPI_SYST_USE_CATALOG
|
#ifdef CONFIG_LOG_MIPI_SYST_USE_CATALOG
|
||||||
|
@ -866,9 +866,9 @@ void log_output_msg2_syst_process(const struct log_output *output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data = log_msg2_get_data(msg, &hexdump_len);
|
data = log_msg_get_data(msg, &hexdump_len);
|
||||||
if (hexdump_len) {
|
if (hexdump_len) {
|
||||||
uint32_t severity = level_to_syst_severity(log_msg2_get_level(msg));
|
uint32_t severity = level_to_syst_severity(log_msg_get_level(msg));
|
||||||
|
|
||||||
hexdump2_print(data, hexdump_len, severity);
|
hexdump2_print(data, hexdump_len, severity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "shell_ops.h"
|
#include "shell_ops.h"
|
||||||
#include <zephyr/logging/log_ctrl.h>
|
#include <zephyr/logging/log_ctrl.h>
|
||||||
|
|
||||||
static bool process_msg2_from_buffer(const struct shell *shell);
|
static bool process_msg_from_buffer(const struct shell *sh);
|
||||||
|
|
||||||
int z_shell_log_backend_output_func(uint8_t *data, size_t length, void *ctx)
|
int z_shell_log_backend_output_func(uint8_t *data, size_t length, void *ctx)
|
||||||
{
|
{
|
||||||
|
@ -29,13 +29,13 @@ void z_shell_log_backend_enable(const struct shell_log_backend *backend,
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
||||||
const struct shell *shell;
|
const struct shell *sh;
|
||||||
|
|
||||||
shell = (const struct shell *)ctx;
|
sh = (const struct shell *)ctx;
|
||||||
|
|
||||||
z_flag_sync_mode_set(shell, true);
|
z_flag_sync_mode_set(sh, true);
|
||||||
/* Reenable transport in blocking mode */
|
/* Reenable transport in blocking mode */
|
||||||
err = shell->iface->api->enable(shell->iface, true);
|
err = sh->iface->api->enable(sh->iface, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
|
@ -55,81 +55,81 @@ void z_shell_log_backend_disable(const struct shell_log_backend *backend)
|
||||||
|
|
||||||
bool z_shell_log_backend_process(const struct shell_log_backend *backend)
|
bool z_shell_log_backend_process(const struct shell_log_backend *backend)
|
||||||
{
|
{
|
||||||
const struct shell *shell =
|
const struct shell *sh =
|
||||||
(const struct shell *)backend->backend->cb->ctx;
|
(const struct shell *)backend->backend->cb->ctx;
|
||||||
uint32_t dropped;
|
uint32_t dropped;
|
||||||
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
|
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
|
||||||
z_flag_use_colors_get(shell);
|
z_flag_use_colors_get(sh);
|
||||||
|
|
||||||
dropped = atomic_set(&backend->control_block->dropped_cnt, 0);
|
dropped = atomic_set(&backend->control_block->dropped_cnt, 0);
|
||||||
if (dropped) {
|
if (dropped) {
|
||||||
struct shell_vt100_colors col;
|
struct shell_vt100_colors col;
|
||||||
|
|
||||||
if (colors) {
|
if (colors) {
|
||||||
z_shell_vt100_colors_store(shell, &col);
|
z_shell_vt100_colors_store(sh, &col);
|
||||||
z_shell_vt100_color_set(shell, SHELL_VT100_COLOR_RED);
|
z_shell_vt100_color_set(sh, SHELL_VT100_COLOR_RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_output_dropped_process(backend->log_output, dropped);
|
log_output_dropped_process(backend->log_output, dropped);
|
||||||
|
|
||||||
if (colors) {
|
if (colors) {
|
||||||
z_shell_vt100_colors_restore(shell, &col);
|
z_shell_vt100_colors_restore(sh, &col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return process_msg2_from_buffer(shell);
|
return process_msg_from_buffer(sh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void panic(const struct log_backend *const backend)
|
static void panic(const struct log_backend *const backend)
|
||||||
{
|
{
|
||||||
const struct shell *shell = (const struct shell *)backend->cb->ctx;
|
const struct shell *sh = (const struct shell *)backend->cb->ctx;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = shell->iface->api->enable(shell->iface, true);
|
err = sh->iface->api->enable(sh->iface, true);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
shell->log_backend->control_block->state =
|
sh->log_backend->control_block->state =
|
||||||
SHELL_LOG_BACKEND_PANIC;
|
SHELL_LOG_BACKEND_PANIC;
|
||||||
z_flag_sync_mode_set(shell, true);
|
z_flag_sync_mode_set(sh, true);
|
||||||
|
|
||||||
/* Move to the start of next line. */
|
/* Move to the start of next line. */
|
||||||
z_shell_multiline_data_calc(&shell->ctx->vt100_ctx.cons,
|
z_shell_multiline_data_calc(&sh->ctx->vt100_ctx.cons,
|
||||||
shell->ctx->cmd_buff_pos,
|
sh->ctx->cmd_buff_pos,
|
||||||
shell->ctx->cmd_buff_len);
|
sh->ctx->cmd_buff_len);
|
||||||
z_shell_op_cursor_vert_move(shell, -1);
|
z_shell_op_cursor_vert_move(sh, -1);
|
||||||
z_shell_op_cursor_horiz_move(shell,
|
z_shell_op_cursor_horiz_move(sh,
|
||||||
-shell->ctx->vt100_ctx.cons.cur_x);
|
-sh->ctx->vt100_ctx.cons.cur_x);
|
||||||
|
|
||||||
while (process_msg2_from_buffer(shell)) {
|
while (process_msg_from_buffer(sh)) {
|
||||||
/* empty */
|
/* empty */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
z_shell_log_backend_disable(shell->log_backend);
|
z_shell_log_backend_disable(sh->log_backend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dropped(const struct log_backend *const backend, uint32_t cnt)
|
static void dropped(const struct log_backend *const backend, uint32_t cnt)
|
||||||
{
|
{
|
||||||
const struct shell *shell = (const struct shell *)backend->cb->ctx;
|
const struct shell *sh = (const struct shell *)backend->cb->ctx;
|
||||||
const struct shell_log_backend *log_backend = shell->log_backend;
|
const struct shell_log_backend *log_backend = sh->log_backend;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_SHELL_STATS)) {
|
if (IS_ENABLED(CONFIG_SHELL_STATS)) {
|
||||||
atomic_add(&shell->stats->log_lost_cnt, cnt);
|
atomic_add(&sh->stats->log_lost_cnt, cnt);
|
||||||
}
|
}
|
||||||
atomic_add(&log_backend->control_block->dropped_cnt, cnt);
|
atomic_add(&log_backend->control_block->dropped_cnt, cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy_to_pbuffer(struct mpsc_pbuf_buffer *mpsc_buffer,
|
static void copy_to_pbuffer(struct mpsc_pbuf_buffer *mpsc_buffer,
|
||||||
union log_msg2_generic *msg, uint32_t timeout)
|
union log_msg_generic *msg, uint32_t timeout)
|
||||||
{
|
{
|
||||||
size_t wlen;
|
size_t wlen;
|
||||||
union mpsc_pbuf_generic *dst;
|
union mpsc_pbuf_generic *dst;
|
||||||
|
|
||||||
wlen = log_msg2_generic_get_wlen((union mpsc_pbuf_generic *)msg);
|
wlen = log_msg_generic_get_wlen((union mpsc_pbuf_generic *)msg);
|
||||||
dst = mpsc_pbuf_alloc(mpsc_buffer, wlen, K_MSEC(timeout));
|
dst = mpsc_pbuf_alloc(mpsc_buffer, wlen, K_MSEC(timeout));
|
||||||
if (!dst) {
|
if (!dst) {
|
||||||
/* No space to store the log */
|
/* No space to store the log */
|
||||||
|
@ -150,9 +150,9 @@ static void copy_to_pbuffer(struct mpsc_pbuf_buffer *mpsc_buffer,
|
||||||
mpsc_pbuf_commit(mpsc_buffer, dst);
|
mpsc_pbuf_commit(mpsc_buffer, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_log_msg2(const struct shell *shell,
|
static void process_log_msg(const struct shell *sh,
|
||||||
const struct log_output *log_output,
|
const struct log_output *log_output,
|
||||||
union log_msg2_generic *msg,
|
union log_msg_generic *msg,
|
||||||
bool locked, bool colors)
|
bool locked, bool colors)
|
||||||
{
|
{
|
||||||
unsigned int key;
|
unsigned int key;
|
||||||
|
@ -166,36 +166,36 @@ static void process_log_msg2(const struct shell *shell,
|
||||||
|
|
||||||
if (locked) {
|
if (locked) {
|
||||||
key = irq_lock();
|
key = irq_lock();
|
||||||
if (!z_flag_cmd_ctx_get(shell)) {
|
if (!z_flag_cmd_ctx_get(sh)) {
|
||||||
z_shell_cmd_line_erase(shell);
|
z_shell_cmd_line_erase(sh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log_output_msg2_process(log_output, &msg->log, flags);
|
log_output_msg_process(log_output, &msg->log, flags);
|
||||||
|
|
||||||
if (locked) {
|
if (locked) {
|
||||||
if (!z_flag_cmd_ctx_get(shell)) {
|
if (!z_flag_cmd_ctx_get(sh)) {
|
||||||
z_shell_print_prompt_and_cmd(shell);
|
z_shell_print_prompt_and_cmd(sh);
|
||||||
}
|
}
|
||||||
irq_unlock(key);
|
irq_unlock(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool process_msg2_from_buffer(const struct shell *shell)
|
static bool process_msg_from_buffer(const struct shell *sh)
|
||||||
{
|
{
|
||||||
const struct shell_log_backend *log_backend = shell->log_backend;
|
const struct shell_log_backend *log_backend = sh->log_backend;
|
||||||
struct mpsc_pbuf_buffer *mpsc_buffer = log_backend->mpsc_buffer;
|
struct mpsc_pbuf_buffer *mpsc_buffer = log_backend->mpsc_buffer;
|
||||||
const struct log_output *log_output = log_backend->log_output;
|
const struct log_output *log_output = log_backend->log_output;
|
||||||
union log_msg2_generic *msg;
|
union log_msg_generic *msg;
|
||||||
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
|
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
|
||||||
z_flag_use_colors_get(shell);
|
z_flag_use_colors_get(sh);
|
||||||
|
|
||||||
msg = (union log_msg2_generic *)mpsc_pbuf_claim(mpsc_buffer);
|
msg = (union log_msg_generic *)mpsc_pbuf_claim(mpsc_buffer);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_log_msg2(shell, log_output, msg, false, colors);
|
process_log_msg(sh, log_output, msg, false, colors);
|
||||||
|
|
||||||
mpsc_pbuf_free(mpsc_buffer, &msg->buf);
|
mpsc_pbuf_free(mpsc_buffer, &msg->buf);
|
||||||
|
|
||||||
|
@ -203,35 +203,35 @@ static bool process_msg2_from_buffer(const struct shell *shell)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
const struct shell *shell = (const struct shell *)backend->cb->ctx;
|
const struct shell *sh = (const struct shell *)backend->cb->ctx;
|
||||||
const struct shell_log_backend *log_backend = shell->log_backend;
|
const struct shell_log_backend *log_backend = sh->log_backend;
|
||||||
struct mpsc_pbuf_buffer *mpsc_buffer = log_backend->mpsc_buffer;
|
struct mpsc_pbuf_buffer *mpsc_buffer = log_backend->mpsc_buffer;
|
||||||
const struct log_output *log_output = log_backend->log_output;
|
const struct log_output *log_output = log_backend->log_output;
|
||||||
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
|
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
|
||||||
z_flag_use_colors_get(shell);
|
z_flag_use_colors_get(sh);
|
||||||
struct k_poll_signal *signal;
|
struct k_poll_signal *signal;
|
||||||
|
|
||||||
switch (shell->log_backend->control_block->state) {
|
switch (sh->log_backend->control_block->state) {
|
||||||
case SHELL_LOG_BACKEND_ENABLED:
|
case SHELL_LOG_BACKEND_ENABLED:
|
||||||
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
||||||
process_log_msg2(shell, log_output, msg, true, colors);
|
process_log_msg(sh, log_output, msg, true, colors);
|
||||||
} else {
|
} else {
|
||||||
copy_to_pbuffer(mpsc_buffer, msg,
|
copy_to_pbuffer(mpsc_buffer, msg,
|
||||||
log_backend->timeout);
|
log_backend->timeout);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_MULTITHREADING)) {
|
if (IS_ENABLED(CONFIG_MULTITHREADING)) {
|
||||||
signal =
|
signal =
|
||||||
&shell->ctx->signals[SHELL_SIGNAL_LOG_MSG];
|
&sh->ctx->signals[SHELL_SIGNAL_LOG_MSG];
|
||||||
k_poll_signal_raise(signal, 0);
|
k_poll_signal_raise(signal, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SHELL_LOG_BACKEND_PANIC:
|
case SHELL_LOG_BACKEND_PANIC:
|
||||||
z_shell_cmd_line_erase(shell);
|
z_shell_cmd_line_erase(sh);
|
||||||
process_log_msg2(shell, log_output, msg, true, colors);
|
process_log_msg(sh, log_output, msg, true, colors);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,15 @@
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(test, CONFIG_SAMPLE_MODULE_LOG_LEVEL);
|
LOG_MODULE_REGISTER(test, CONFIG_SAMPLE_MODULE_LOG_LEVEL);
|
||||||
|
|
||||||
#ifdef CONFIG_LOG2_USE_TAGGED_ARGUMENTS
|
#ifdef CONFIG_LOG_USE_TAGGED_ARGUMENTS
|
||||||
/* The extra sizeof(int) is the end of arguments tag. */
|
/* The extra sizeof(int) is the end of arguments tag. */
|
||||||
#define LOG_SIMPLE_MSG_LEN \
|
#define LOG_SIMPLE_MSG_LEN \
|
||||||
ROUND_UP(sizeof(struct log_msg2_hdr) + \
|
ROUND_UP(sizeof(struct log_msg_hdr) + \
|
||||||
sizeof(struct cbprintf_package_hdr_ext) + \
|
sizeof(struct cbprintf_package_hdr_ext) + \
|
||||||
sizeof(int), sizeof(long long))
|
sizeof(int), sizeof(long long))
|
||||||
#else
|
#else
|
||||||
#define LOG_SIMPLE_MSG_LEN \
|
#define LOG_SIMPLE_MSG_LEN \
|
||||||
ROUND_UP(sizeof(struct log_msg2_hdr) + \
|
ROUND_UP(sizeof(struct log_msg_hdr) + \
|
||||||
sizeof(struct cbprintf_package_hdr_ext), sizeof(long long))
|
sizeof(struct cbprintf_package_hdr_ext), sizeof(long long))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ ZTEST(test_log_api, test_log_backend_runtime_filtering)
|
||||||
|
|
||||||
static size_t get_max_hexdump(void)
|
static size_t get_max_hexdump(void)
|
||||||
{
|
{
|
||||||
return CONFIG_LOG_BUFFER_SIZE - sizeof(struct log_msg2_hdr);
|
return CONFIG_LOG_BUFFER_SIZE - sizeof(struct log_msg_hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_POSIX)
|
#if defined(CONFIG_ARCH_POSIX)
|
||||||
|
@ -348,7 +348,7 @@ static size_t get_long_hexdump(void)
|
||||||
size_t extra_msg_sz = 0;
|
size_t extra_msg_sz = 0;
|
||||||
size_t extra_hexdump_sz = 0;
|
size_t extra_hexdump_sz = 0;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_LOG2_USE_TAGGED_ARGUMENTS)) {
|
if (IS_ENABLED(CONFIG_LOG_USE_TAGGED_ARGUMENTS)) {
|
||||||
/* First message with 2 arguments => 2 tags */
|
/* First message with 2 arguments => 2 tags */
|
||||||
extra_msg_sz = 2 * sizeof(int);
|
extra_msg_sz = 2 * sizeof(int);
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ static int out(int c, void *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
struct mock_log_backend *mock = backend->cb->ctx;
|
struct mock_log_backend *mock = backend->cb->ctx;
|
||||||
struct mock_log_backend_msg *exp = &mock->exp_msgs[mock->msg_proc_idx];
|
struct mock_log_backend_msg *exp = &mock->exp_msgs[mock->msg_proc_idx];
|
||||||
|
@ -161,7 +161,7 @@ static void process(const struct log_backend *const backend,
|
||||||
size_t len;
|
size_t len;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
|
||||||
data = log_msg2_get_data(&msg->log, &len);
|
data = log_msg_get_data(&msg->log, &len);
|
||||||
zassert_equal(exp->data_len, len, NULL);
|
zassert_equal(exp->data_len, len, NULL);
|
||||||
if (exp->data_len <= sizeof(exp->data)) {
|
if (exp->data_len <= sizeof(exp->data)) {
|
||||||
zassert_equal(memcmp(data, exp->data, len), 0, NULL);
|
zassert_equal(memcmp(data, exp->data, len), 0, NULL);
|
||||||
|
@ -170,7 +170,7 @@ static void process(const struct log_backend *const backend,
|
||||||
char str[128];
|
char str[128];
|
||||||
struct test_str s = { .str = str };
|
struct test_str s = { .str = str };
|
||||||
|
|
||||||
data = log_msg2_get_package(&msg->log, &len);
|
data = log_msg_get_package(&msg->log, &len);
|
||||||
len = cbpprintf(out, &s, data);
|
len = cbpprintf(out, &s, data);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
str[len] = '\0';
|
str[len] = '\0';
|
||||||
|
|
|
@ -84,7 +84,7 @@ static int out(int c, void *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_frontend_msg(const void *source,
|
void log_frontend_msg(const void *source,
|
||||||
const struct log_msg2_desc desc,
|
const struct log_msg_desc desc,
|
||||||
uint8_t *package, const void *data)
|
uint8_t *package, const void *data)
|
||||||
{
|
{
|
||||||
struct mock_log_backend_msg *exp_msg = &mock.exp_msgs[mock.msg_proc_idx];
|
struct mock_log_backend_msg *exp_msg = &mock.exp_msgs[mock.msg_proc_idx];
|
||||||
|
|
|
@ -324,7 +324,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_MODE_OVERFLOW=y
|
- CONFIG_LOG_MODE_OVERFLOW=y
|
||||||
- CONFIG_LOG_RUNTIME_FILTERING=y
|
- CONFIG_LOG_RUNTIME_FILTERING=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_overflow.tagged_args:
|
logging.log_api_deferred_overflow.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -333,7 +333,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_MODE_OVERFLOW=y
|
- CONFIG_LOG_MODE_OVERFLOW=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_no_overflow.tagged_args:
|
logging.log_api_deferred_no_overflow.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -342,7 +342,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_MODE_OVERFLOW=n
|
- CONFIG_LOG_MODE_OVERFLOW=n
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_static_filter.tagged_args:
|
logging.log_api_deferred_static_filter.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -351,7 +351,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_printk.tagged_args:
|
logging.log_api_deferred_printk.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -363,7 +363,7 @@ tests:
|
||||||
- CONFIG_LOG_PRINTK=y
|
- CONFIG_LOG_PRINTK=y
|
||||||
#When LOG_PRINTK is enabled, thread must process otherwise test output would be lost.
|
#When LOG_PRINTK is enabled, thread must process otherwise test output would be lost.
|
||||||
- CONFIG_LOG_PROCESS_THREAD=y
|
- CONFIG_LOG_PROCESS_THREAD=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_func_prefix.tagged_args:
|
logging.log_api_deferred_func_prefix.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -373,7 +373,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
||||||
- CONFIG_LOG_FUNC_NAME_PREFIX_DBG=y
|
- CONFIG_LOG_FUNC_NAME_PREFIX_DBG=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_64b_timestamp.tagged_args:
|
logging.log_api_deferred_64b_timestamp.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -382,7 +382,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_override_level.tagged_args:
|
logging.log_api_deferred_override_level.tagged_args:
|
||||||
# Testing on selected platforms as it enables all logs in the application
|
# Testing on selected platforms as it enables all logs in the application
|
||||||
|
@ -392,7 +392,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_OVERRIDE_LEVEL=4
|
- CONFIG_LOG_OVERRIDE_LEVEL=4
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_override_level_rt_filtering.tagged_args:
|
logging.log_api_deferred_override_level_rt_filtering.tagged_args:
|
||||||
# Testing on selected platforms as it enables all logs in the application
|
# Testing on selected platforms as it enables all logs in the application
|
||||||
|
@ -403,7 +403,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_RUNTIME_FILTERING=y
|
- CONFIG_LOG_RUNTIME_FILTERING=y
|
||||||
- CONFIG_LOG_OVERRIDE_LEVEL=4
|
- CONFIG_LOG_OVERRIDE_LEVEL=4
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate.tagged_args:
|
logging.log_api_immediate.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -411,7 +411,7 @@ tests:
|
||||||
toolchain_exclude: xcc
|
toolchain_exclude: xcc
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_printk.tagged_args:
|
logging.log_api_immediate_printk.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -420,7 +420,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_LOG_PRINTK=y
|
- CONFIG_LOG_PRINTK=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_rt_filter.tagged_args:
|
logging.log_api_immediate_rt_filter.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -429,7 +429,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_LOG_RUNTIME_FILTERING=y
|
- CONFIG_LOG_RUNTIME_FILTERING=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_static_filter.tagged_args:
|
logging.log_api_immediate_static_filter.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -438,7 +438,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_64b_timestamp.tagged_args:
|
logging.log_api_immediate_64b_timestamp.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -447,7 +447,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_overflow_rt_filter_cpp.tagged_args:
|
logging.log_api_deferred_overflow_rt_filter_cpp.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -458,7 +458,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_OVERFLOW=y
|
- CONFIG_LOG_MODE_OVERFLOW=y
|
||||||
- CONFIG_LOG_RUNTIME_FILTERING=y
|
- CONFIG_LOG_RUNTIME_FILTERING=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_overflow_cpp.tagged_args:
|
logging.log_api_deferred_overflow_cpp.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -468,7 +468,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_MODE_OVERFLOW=y
|
- CONFIG_LOG_MODE_OVERFLOW=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_no_overflow_cpp.tagged_args:
|
logging.log_api_deferred_no_overflow_cpp.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -478,7 +478,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_MODE_OVERFLOW=n
|
- CONFIG_LOG_MODE_OVERFLOW=n
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_static_filter_cpp.tagged_args:
|
logging.log_api_deferred_static_filter_cpp.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -488,7 +488,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_printk_cpp.tagged_args:
|
logging.log_api_deferred_printk_cpp.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -501,7 +501,7 @@ tests:
|
||||||
#When LOG_PRINTK is enabled, thread must process otherwise test output would be lost.
|
#When LOG_PRINTK is enabled, thread must process otherwise test output would be lost.
|
||||||
- CONFIG_LOG_PROCESS_THREAD=y
|
- CONFIG_LOG_PROCESS_THREAD=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_func_prefix_cpp.tagged_args:
|
logging.log_api_deferred_func_prefix_cpp.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -512,7 +512,7 @@ tests:
|
||||||
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
||||||
- CONFIG_LOG_FUNC_NAME_PREFIX_DBG=y
|
- CONFIG_LOG_FUNC_NAME_PREFIX_DBG=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_deferred_64b_timestamp_cpp.tagged_args:
|
logging.log_api_deferred_64b_timestamp_cpp.tagged_args:
|
||||||
# FIXME:see #38041
|
# FIXME:see #38041
|
||||||
|
@ -522,7 +522,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_DEFERRED=y
|
- CONFIG_LOG_MODE_DEFERRED=y
|
||||||
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_cpp.tagged_args:
|
logging.log_api_immediate_cpp.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -531,7 +531,7 @@ tests:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_printk_cpp.tagged_args:
|
logging.log_api_immediate_printk_cpp.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -541,7 +541,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_LOG_PRINTK=y
|
- CONFIG_LOG_PRINTK=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_rt_filter_cpp.tagged_args:
|
logging.log_api_immediate_rt_filter_cpp.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -551,7 +551,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_LOG_RUNTIME_FILTERING=y
|
- CONFIG_LOG_RUNTIME_FILTERING=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_static_filter_cpp.tagged_args:
|
logging.log_api_immediate_static_filter_cpp.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -561,7 +561,7 @@ tests:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
- CONFIG_SAMPLE_MODULE_LOG_LEVEL_DBG=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
||||||
logging.log_api_immediate_64b_timestamp_cpp.tagged_args:
|
logging.log_api_immediate_64b_timestamp_cpp.tagged_args:
|
||||||
# FIXME: qemu_arc_hs6x excluded, see #38041
|
# FIXME: qemu_arc_hs6x excluded, see #38041
|
||||||
|
@ -571,4 +571,4 @@ tests:
|
||||||
- CONFIG_LOG_MODE_IMMEDIATE=y
|
- CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
||||||
- CONFIG_CPLUSPLUS=y
|
- CONFIG_CPLUSPLUS=y
|
||||||
- CONFIG_LOG2_USE_TAGGED_ARGUMENTS=y
|
- CONFIG_LOG_USE_TAGGED_ARGUMENTS=y
|
||||||
|
|
|
@ -35,13 +35,13 @@ static int cbprintf_callback(int c, void *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void backend_process(const struct log_backend *const backend,
|
static void backend_process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
char str[100];
|
char str[100];
|
||||||
char *pstr = str;
|
char *pstr = str;
|
||||||
struct backend_context *context = (struct backend_context *)backend->cb->ctx;
|
struct backend_context *context = (struct backend_context *)backend->cb->ctx;
|
||||||
size_t len;
|
size_t len;
|
||||||
uint8_t *p = log_msg2_get_package(&msg->log, &len);
|
uint8_t *p = log_msg_get_package(&msg->log, &len);
|
||||||
|
|
||||||
(void)len;
|
(void)len;
|
||||||
int slen = cbpprintf(cbprintf_callback, &pstr, p);
|
int slen = cbpprintf(cbprintf_callback, &pstr, p);
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct backend_cb {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void process(struct log_backend const *const backend,
|
static void process(struct log_backend const *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ static K_SEM_DEFINE(log_sem, 0, 1);
|
||||||
|
|
||||||
#define TIMESTAMP_FREC (2000000)
|
#define TIMESTAMP_FREC (2000000)
|
||||||
ZTEST_BMEM uint32_t source_id;
|
ZTEST_BMEM uint32_t source_id;
|
||||||
/* used when log_msg2 create in user space */
|
/* used when log_msg create in user space */
|
||||||
ZTEST_BMEM uint8_t domain, level;
|
ZTEST_BMEM uint8_t domain, level;
|
||||||
ZTEST_DMEM uint32_t msg_data = 0x1234;
|
ZTEST_DMEM uint32_t msg_data = 0x1234;
|
||||||
ZTEST_DMEM char *test_msg_usr = "test msg";
|
ZTEST_DMEM char *test_msg_usr = "test msg";
|
||||||
|
@ -61,7 +61,7 @@ struct backend_cb {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
struct backend_cb *cb = (struct backend_cb *)backend->cb->ctx;
|
struct backend_cb *cb = (struct backend_cb *)backend->cb->ctx;
|
||||||
|
@ -71,19 +71,19 @@ static void process(const struct log_backend *const backend,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cb->check_domain_id) {
|
if (cb->check_domain_id) {
|
||||||
zassert_equal(log_msg2_get_domain(&(msg->log)), CONFIG_LOG_DOMAIN_ID,
|
zassert_equal(log_msg_get_domain(&(msg->log)), CONFIG_LOG_DOMAIN_ID,
|
||||||
"Unexpected domain id");
|
"Unexpected domain id");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cb->check_timestamp) {
|
if (cb->check_timestamp) {
|
||||||
uint32_t exp_timestamp = cb->exp_timestamps[cb->counter];
|
uint32_t exp_timestamp = cb->exp_timestamps[cb->counter];
|
||||||
|
|
||||||
zassert_equal(log_msg2_get_timestamp(&(msg->log)), exp_timestamp,
|
zassert_equal(log_msg_get_timestamp(&(msg->log)), exp_timestamp,
|
||||||
"Unexpected message index");
|
"Unexpected message index");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cb->check_severity) {
|
if (cb->check_severity) {
|
||||||
zassert_equal(log_msg2_get_level(&(msg->log)),
|
zassert_equal(log_msg_get_level(&(msg->log)),
|
||||||
cb->exp_severity[cb->counter],
|
cb->exp_severity[cb->counter],
|
||||||
"Unexpected log severity");
|
"Unexpected log severity");
|
||||||
}
|
}
|
||||||
|
@ -96,15 +96,15 @@ static void process(const struct log_backend *const backend,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k_is_user_context()) {
|
if (k_is_user_context()) {
|
||||||
zassert_equal(log_msg2_get_domain(&(msg->log)), domain,
|
zassert_equal(log_msg_get_domain(&(msg->log)), domain,
|
||||||
"Unexpected domain id");
|
"Unexpected domain id");
|
||||||
|
|
||||||
zassert_equal(log_msg2_get_level(&(msg->log)), level,
|
zassert_equal(log_msg_get_level(&(msg->log)), level,
|
||||||
"Unexpected log severity");
|
"Unexpected log severity");
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = log_backend_std_get_flags();
|
flags = log_backend_std_get_flags();
|
||||||
log_output_msg2_process(&log_output, &msg->log, flags);
|
log_output_msg_process(&log_output, &msg->log, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void panic(const struct log_backend *const backend)
|
static void panic(const struct log_backend *const backend)
|
||||||
|
@ -448,7 +448,7 @@ void test_log_generic(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_log_msg2_create(void)
|
void test_log_msg_create(void)
|
||||||
{
|
{
|
||||||
log_setup(false);
|
log_setup(false);
|
||||||
if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
||||||
|
@ -457,10 +457,10 @@ void test_log_msg2_create(void)
|
||||||
domain = 3;
|
domain = 3;
|
||||||
level = 2;
|
level = 2;
|
||||||
|
|
||||||
z_log_msg2_runtime_create(domain, __log_current_const_data,
|
z_log_msg_runtime_create(domain, __log_current_const_data,
|
||||||
level, &msg_data, 0,
|
level, &msg_data, 0,
|
||||||
sizeof(msg_data), NULL);
|
sizeof(msg_data), NULL);
|
||||||
/* try z_log_msg2_static_create() */
|
/* try z_log_msg_static_create() */
|
||||||
Z_LOG_MSG2_STACK_CREATE(0, domain, __log_current_const_data,
|
Z_LOG_MSG2_STACK_CREATE(0, domain, __log_current_const_data,
|
||||||
level, &msg_data,
|
level, &msg_data,
|
||||||
sizeof(msg_data), NULL);
|
sizeof(msg_data), NULL);
|
||||||
|
@ -474,17 +474,17 @@ void test_log_msg2_create(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_log_msg2_create_user(void)
|
void test_log_msg_create_user(void)
|
||||||
{
|
{
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
domain = 3;
|
domain = 3;
|
||||||
level = 2;
|
level = 2;
|
||||||
|
|
||||||
z_log_msg2_runtime_create(domain, NULL,
|
z_log_msg_runtime_create(domain, NULL,
|
||||||
level, &msg_data, 0,
|
level, &msg_data, 0,
|
||||||
sizeof(msg_data), test_msg_usr);
|
sizeof(msg_data), test_msg_usr);
|
||||||
/* try z_log_msg2_static_create() */
|
/* try z_log_msg_static_create() */
|
||||||
Z_LOG_MSG2_STACK_CREATE(0, domain, NULL,
|
Z_LOG_MSG2_STACK_CREATE(0, domain, NULL,
|
||||||
level, &msg_data,
|
level, &msg_data,
|
||||||
sizeof(msg_data), test_msg_usr);
|
sizeof(msg_data), test_msg_usr);
|
||||||
|
@ -527,7 +527,7 @@ void test_main(void)
|
||||||
ztest_user_unit_test(test_log_generic_user),
|
ztest_user_unit_test(test_log_generic_user),
|
||||||
ztest_user_unit_test(test_log_filter_set),
|
ztest_user_unit_test(test_log_filter_set),
|
||||||
ztest_user_unit_test(test_log_panic),
|
ztest_user_unit_test(test_log_panic),
|
||||||
ztest_user_unit_test(test_log_msg2_create_user));
|
ztest_user_unit_test(test_log_msg_create_user));
|
||||||
ztest_run_test_suite(test_log_core_additional);
|
ztest_run_test_suite(test_log_core_additional);
|
||||||
#else
|
#else
|
||||||
ztest_test_suite(test_log_core_additional,
|
ztest_test_suite(test_log_core_additional,
|
||||||
|
@ -539,7 +539,7 @@ void test_main(void)
|
||||||
ztest_unit_test(test_log_early_logging),
|
ztest_unit_test(test_log_early_logging),
|
||||||
ztest_unit_test(test_log_sync),
|
ztest_unit_test(test_log_sync),
|
||||||
ztest_unit_test(test_log_thread),
|
ztest_unit_test(test_log_thread),
|
||||||
ztest_unit_test(test_log_msg2_create)
|
ztest_unit_test(test_log_msg_create)
|
||||||
);
|
);
|
||||||
ztest_run_test_suite(test_log_core_additional);
|
ztest_run_test_suite(test_log_core_additional);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@ tests:
|
||||||
- log_early_logging
|
- log_early_logging
|
||||||
- log_sync
|
- log_sync
|
||||||
- log_thread
|
- log_thread
|
||||||
- log_msg2_create
|
- log_msg_create
|
||||||
logging.add.sync:
|
logging.add.sync:
|
||||||
tags: logging
|
tags: logging
|
||||||
extra_args: CONF_FILE=log_sync.conf
|
extra_args: CONF_FILE=log_sync.conf
|
||||||
|
@ -28,7 +28,7 @@ tests:
|
||||||
- log_early_logging
|
- log_early_logging
|
||||||
- log_sync
|
- log_sync
|
||||||
- log_thread
|
- log_thread
|
||||||
- log_msg2_create
|
- log_msg_create
|
||||||
logging.add.log_user:
|
logging.add.log_user:
|
||||||
tags: logging
|
tags: logging
|
||||||
filter: CONFIG_USERSPACE
|
filter: CONFIG_USERSPACE
|
||||||
|
@ -41,4 +41,4 @@ tests:
|
||||||
- log_generic_user
|
- log_generic_user
|
||||||
- log_filter_set
|
- log_filter_set
|
||||||
- log_panic
|
- log_panic
|
||||||
- log_msg2_create_user
|
- log_msg_create_user
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.20.0)
|
cmake_minimum_required(VERSION 3.20.0)
|
||||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
project(log_msg2)
|
project(log_msg)
|
||||||
|
|
||||||
FILE(GLOB app_sources src/*.c)
|
FILE(GLOB app_sources src/*.c)
|
||||||
target_sources(app PRIVATE ${app_sources})
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
|
@ -38,11 +38,11 @@ log_timestamp_t get_timestamp(void)
|
||||||
static void test_init(void)
|
static void test_init(void)
|
||||||
{
|
{
|
||||||
timestamp = TEST_TIMESTAMP_INIT_VALUE;
|
timestamp = TEST_TIMESTAMP_INIT_VALUE;
|
||||||
z_log_msg2_init();
|
z_log_msg_init();
|
||||||
log_set_timestamp_func(get_timestamp, 0);
|
log_set_timestamp_func(get_timestamp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_msg(struct log_msg2 *msg)
|
void print_msg(struct log_msg *msg)
|
||||||
{
|
{
|
||||||
printk("-----------------------printing message--------------------\n");
|
printk("-----------------------printing message--------------------\n");
|
||||||
printk("message %p\n", msg);
|
printk("message %p\n", msg);
|
||||||
|
@ -72,7 +72,7 @@ int out(int c, void *ctx)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void basic_validate(struct log_msg2 *msg,
|
static void basic_validate(struct log_msg *msg,
|
||||||
const struct log_source_const_data *source,
|
const struct log_source_const_data *source,
|
||||||
uint8_t domain, uint8_t level, log_timestamp_t t,
|
uint8_t domain, uint8_t level, log_timestamp_t t,
|
||||||
const void *data, size_t data_len, char *str)
|
const void *data, size_t data_len, char *str)
|
||||||
|
@ -83,19 +83,19 @@ static void basic_validate(struct log_msg2 *msg,
|
||||||
char buf[256];
|
char buf[256];
|
||||||
struct test_buf tbuf = { .buf = buf, .idx = 0 };
|
struct test_buf tbuf = { .buf = buf, .idx = 0 };
|
||||||
|
|
||||||
zassert_equal(log_msg2_get_source(msg), (void *)source, NULL);
|
zassert_equal(log_msg_get_source(msg), (void *)source, NULL);
|
||||||
zassert_equal(log_msg2_get_domain(msg), domain, NULL);
|
zassert_equal(log_msg_get_domain(msg), domain, NULL);
|
||||||
zassert_equal(log_msg2_get_level(msg), level, NULL);
|
zassert_equal(log_msg_get_level(msg), level, NULL);
|
||||||
zassert_equal(log_msg2_get_timestamp(msg), t, NULL);
|
zassert_equal(log_msg_get_timestamp(msg), t, NULL);
|
||||||
|
|
||||||
d = log_msg2_get_data(msg, &len);
|
d = log_msg_get_data(msg, &len);
|
||||||
zassert_equal(len, data_len, NULL);
|
zassert_equal(len, data_len, NULL);
|
||||||
if (len) {
|
if (len) {
|
||||||
rv = memcmp(d, data, data_len);
|
rv = memcmp(d, data, data_len);
|
||||||
zassert_equal(rv, 0, NULL);
|
zassert_equal(rv, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
d = log_msg2_get_package(msg, &len);
|
d = log_msg_get_package(msg, &len);
|
||||||
if (str) {
|
if (str) {
|
||||||
rv = cbpprintf(out, &tbuf, d);
|
rv = cbpprintf(out, &tbuf, d);
|
||||||
zassert_true(rv > 0, NULL);
|
zassert_true(rv > 0, NULL);
|
||||||
|
@ -106,22 +106,22 @@ static void basic_validate(struct log_msg2 *msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
union log_msg2_generic *msg_copy_and_free(union log_msg2_generic *msg,
|
union log_msg_generic *msg_copy_and_free(union log_msg_generic *msg,
|
||||||
uint8_t *buf, size_t buf_len)
|
uint8_t *buf, size_t buf_len)
|
||||||
{
|
{
|
||||||
size_t len = sizeof(int) *
|
size_t len = sizeof(int) *
|
||||||
log_msg2_generic_get_wlen((union mpsc_pbuf_generic *)msg);
|
log_msg_generic_get_wlen((union mpsc_pbuf_generic *)msg);
|
||||||
|
|
||||||
zassert_true(len < buf_len, NULL);
|
zassert_true(len < buf_len, NULL);
|
||||||
|
|
||||||
memcpy(buf, msg, len);
|
memcpy(buf, msg, len);
|
||||||
|
|
||||||
z_log_msg2_free(msg);
|
z_log_msg_free(msg);
|
||||||
|
|
||||||
return (union log_msg2_generic *)buf;
|
return (union log_msg_generic *)buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_pkg_flags(struct log_msg2 *msg)
|
void clear_pkg_flags(struct log_msg *msg)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_CBPRINTF_PACKAGE_HEADER_STORE_CREATION_FLAGS
|
#ifdef CONFIG_CBPRINTF_PACKAGE_HEADER_STORE_CREATION_FLAGS
|
||||||
/*
|
/*
|
||||||
|
@ -136,7 +136,7 @@ void clear_pkg_flags(struct log_msg2 *msg)
|
||||||
uint8_t *d;
|
uint8_t *d;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
d = log_msg2_get_package(msg, &len);
|
d = log_msg_get_package(msg, &len);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
union cbprintf_package_hdr *hdr = (void *)d;
|
union cbprintf_package_hdr *hdr = (void *)d;
|
||||||
|
|
||||||
|
@ -156,23 +156,23 @@ void validate_base_message_set(const struct log_source_const_data *source,
|
||||||
uint8_t __aligned(Z_LOG_MSG2_ALIGNMENT) buf1[256];
|
uint8_t __aligned(Z_LOG_MSG2_ALIGNMENT) buf1[256];
|
||||||
uint8_t __aligned(Z_LOG_MSG2_ALIGNMENT) buf2[256];
|
uint8_t __aligned(Z_LOG_MSG2_ALIGNMENT) buf2[256];
|
||||||
size_t len0, len1, len2;
|
size_t len0, len1, len2;
|
||||||
union log_msg2_generic *msg0, *msg1, *msg2;
|
union log_msg_generic *msg0, *msg1, *msg2;
|
||||||
|
|
||||||
msg0 = z_log_msg2_claim();
|
msg0 = z_log_msg_claim();
|
||||||
zassert_true(msg0, "Unexpected null message");
|
zassert_true(msg0, "Unexpected null message");
|
||||||
len0 = log_msg2_generic_get_wlen((union mpsc_pbuf_generic *)msg0);
|
len0 = log_msg_generic_get_wlen((union mpsc_pbuf_generic *)msg0);
|
||||||
msg0 = msg_copy_and_free(msg0, buf0, sizeof(buf0));
|
msg0 = msg_copy_and_free(msg0, buf0, sizeof(buf0));
|
||||||
clear_pkg_flags(&msg0->log);
|
clear_pkg_flags(&msg0->log);
|
||||||
|
|
||||||
msg1 = z_log_msg2_claim();
|
msg1 = z_log_msg_claim();
|
||||||
zassert_true(msg1, "Unexpected null message");
|
zassert_true(msg1, "Unexpected null message");
|
||||||
len1 = log_msg2_generic_get_wlen((union mpsc_pbuf_generic *)msg1);
|
len1 = log_msg_generic_get_wlen((union mpsc_pbuf_generic *)msg1);
|
||||||
msg1 = msg_copy_and_free(msg1, buf1, sizeof(buf1));
|
msg1 = msg_copy_and_free(msg1, buf1, sizeof(buf1));
|
||||||
clear_pkg_flags(&msg1->log);
|
clear_pkg_flags(&msg1->log);
|
||||||
|
|
||||||
msg2 = z_log_msg2_claim();
|
msg2 = z_log_msg_claim();
|
||||||
zassert_true(msg2, "Unexpected null message");
|
zassert_true(msg2, "Unexpected null message");
|
||||||
len2 = log_msg2_generic_get_wlen((union mpsc_pbuf_generic *)msg2);
|
len2 = log_msg_generic_get_wlen((union mpsc_pbuf_generic *)msg2);
|
||||||
msg2 = msg_copy_and_free(msg2, buf2, sizeof(buf2));
|
msg2 = msg_copy_and_free(msg2, buf2, sizeof(buf2));
|
||||||
clear_pkg_flags(&msg2->log);
|
clear_pkg_flags(&msg2->log);
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void validate_base_message_set(const struct log_source_const_data *source,
|
||||||
t, data, data_len, str);
|
t, data, data_len, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_log_msg2_0_args_msg(void)
|
void test_log_msg_0_args_msg(void)
|
||||||
{
|
{
|
||||||
#undef TEST_MSG
|
#undef TEST_MSG
|
||||||
#define TEST_MSG "0 args"
|
#define TEST_MSG "0 args"
|
||||||
|
@ -217,7 +217,7 @@ void test_log_msg2_0_args_msg(void)
|
||||||
NULL, 0, TEST_MSG);
|
NULL, 0, TEST_MSG);
|
||||||
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
||||||
|
|
||||||
z_log_msg2_runtime_create(domain, source,
|
z_log_msg_runtime_create(domain, source,
|
||||||
level, NULL, 0, 0, TEST_MSG);
|
level, NULL, 0, 0, TEST_MSG);
|
||||||
|
|
||||||
validate_base_message_set(source, domain, level,
|
validate_base_message_set(source, domain, level,
|
||||||
|
@ -225,7 +225,7 @@ void test_log_msg2_0_args_msg(void)
|
||||||
NULL, 0, TEST_MSG);
|
NULL, 0, TEST_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_log_msg2_various_args(void)
|
void test_log_msg_various_args(void)
|
||||||
{
|
{
|
||||||
#undef TEST_MSG
|
#undef TEST_MSG
|
||||||
#define TEST_MSG "%d %d %lld %p %lld %p"
|
#define TEST_MSG "%d %d %lld %p %lld %p"
|
||||||
|
@ -250,7 +250,7 @@ void test_log_msg2_various_args(void)
|
||||||
TEST_MSG, s8, u, lld, (void *)str, lld, (void *)iarray);
|
TEST_MSG, s8, u, lld, (void *)str, lld, (void *)iarray);
|
||||||
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
||||||
|
|
||||||
z_log_msg2_runtime_create(domain, (void *)source, level, NULL,
|
z_log_msg_runtime_create(domain, (void *)source, level, NULL,
|
||||||
0, 0, TEST_MSG, s8, u, lld, str, lld, iarray);
|
0, 0, TEST_MSG, s8, u, lld, str, lld, iarray);
|
||||||
snprintfcb(str, sizeof(str), TEST_MSG, s8, u, lld, str, lld, iarray);
|
snprintfcb(str, sizeof(str), TEST_MSG, s8, u, lld, str, lld, iarray);
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ void test_log_msg2_various_args(void)
|
||||||
NULL, 0, str);
|
NULL, 0, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_log_msg2_only_data(void)
|
void test_log_msg_only_data(void)
|
||||||
{
|
{
|
||||||
static const uint8_t domain = 3;
|
static const uint8_t domain = 3;
|
||||||
static const uint8_t level = 2;
|
static const uint8_t level = 2;
|
||||||
|
@ -277,7 +277,7 @@ void test_log_msg2_only_data(void)
|
||||||
sizeof(array));
|
sizeof(array));
|
||||||
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
||||||
|
|
||||||
z_log_msg2_runtime_create(domain, (void *)source, level, array,
|
z_log_msg_runtime_create(domain, (void *)source, level, array,
|
||||||
sizeof(array), 0, NULL);
|
sizeof(array), 0, NULL);
|
||||||
|
|
||||||
validate_base_message_set(source, domain, level,
|
validate_base_message_set(source, domain, level,
|
||||||
|
@ -285,7 +285,7 @@ void test_log_msg2_only_data(void)
|
||||||
array, sizeof(array), NULL);
|
array, sizeof(array), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_log_msg2_string_and_data(void)
|
void test_log_msg_string_and_data(void)
|
||||||
{
|
{
|
||||||
#undef TEST_MSG
|
#undef TEST_MSG
|
||||||
#define TEST_MSG "test"
|
#define TEST_MSG "test"
|
||||||
|
@ -306,7 +306,7 @@ void test_log_msg2_string_and_data(void)
|
||||||
sizeof(array), TEST_MSG);
|
sizeof(array), TEST_MSG);
|
||||||
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
||||||
|
|
||||||
z_log_msg2_runtime_create(domain, (void *)source, level, array,
|
z_log_msg_runtime_create(domain, (void *)source, level, array,
|
||||||
sizeof(array), 0, TEST_MSG);
|
sizeof(array), 0, TEST_MSG);
|
||||||
|
|
||||||
validate_base_message_set(source, domain, level,
|
validate_base_message_set(source, domain, level,
|
||||||
|
@ -314,7 +314,7 @@ void test_log_msg2_string_and_data(void)
|
||||||
array, sizeof(array), TEST_MSG);
|
array, sizeof(array), TEST_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_log_msg2_fp(void)
|
void test_log_msg_fp(void)
|
||||||
{
|
{
|
||||||
if (!(IS_ENABLED(CONFIG_CBPRINTF_FP_SUPPORT) && IS_ENABLED(CONFIG_FPU))) {
|
if (!(IS_ENABLED(CONFIG_CBPRINTF_FP_SUPPORT) && IS_ENABLED(CONFIG_FPU))) {
|
||||||
return;
|
return;
|
||||||
|
@ -343,7 +343,7 @@ void test_log_msg2_fp(void)
|
||||||
TEST_MSG, i, lli, (double)f, &i, d, source);
|
TEST_MSG, i, lli, (double)f, &i, d, source);
|
||||||
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
zassert_equal(mode, EXP_MODE(FROM_STACK), NULL);
|
||||||
|
|
||||||
z_log_msg2_runtime_create(domain, (void *)source, level, NULL, 0, 0,
|
z_log_msg_runtime_create(domain, (void *)source, level, NULL, 0, 0,
|
||||||
TEST_MSG, i, lli, (double)f, &i, d, source);
|
TEST_MSG, i, lli, (double)f, &i, d, source);
|
||||||
snprintfcb(str, sizeof(str), TEST_MSG, i, lli, (double)f, &i, d, source);
|
snprintfcb(str, sizeof(str), TEST_MSG, i, lli, (double)f, &i, d, source);
|
||||||
|
|
||||||
|
@ -355,15 +355,15 @@ void test_log_msg2_fp(void)
|
||||||
static void get_msg_validate_length(uint32_t exp_len)
|
static void get_msg_validate_length(uint32_t exp_len)
|
||||||
{
|
{
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
union log_msg2_generic *msg;
|
union log_msg_generic *msg;
|
||||||
|
|
||||||
msg = z_log_msg2_claim();
|
msg = z_log_msg_claim();
|
||||||
len = log_msg2_generic_get_wlen((union mpsc_pbuf_generic *)msg);
|
len = log_msg_generic_get_wlen((union mpsc_pbuf_generic *)msg);
|
||||||
|
|
||||||
zassert_equal(len, exp_len, "Unexpected message length %d (exp:%d)",
|
zassert_equal(len, exp_len, "Unexpected message length %d (exp:%d)",
|
||||||
len, exp_len);
|
len, exp_len);
|
||||||
|
|
||||||
z_log_msg2_free(msg);
|
z_log_msg_free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_mode_size_plain_string(void)
|
void test_mode_size_plain_string(void)
|
||||||
|
@ -390,7 +390,7 @@ void test_mode_size_plain_string(void)
|
||||||
*
|
*
|
||||||
* Message size is rounded up to the required alignment.
|
* Message size is rounded up to the required alignment.
|
||||||
*/
|
*/
|
||||||
exp_len = offsetof(struct log_msg2, data) +
|
exp_len = offsetof(struct log_msg, data) +
|
||||||
/* package */sizeof(struct cbprintf_package_hdr_ext);
|
/* package */sizeof(struct cbprintf_package_hdr_ext);
|
||||||
|
|
||||||
exp_len = ROUND_UP(exp_len, Z_LOG_MSG2_ALIGNMENT) / sizeof(int);
|
exp_len = ROUND_UP(exp_len, Z_LOG_MSG2_ALIGNMENT) / sizeof(int);
|
||||||
|
@ -421,7 +421,7 @@ void test_mode_size_data_only(void)
|
||||||
*
|
*
|
||||||
* Message size is rounded up to the required alignment.
|
* Message size is rounded up to the required alignment.
|
||||||
*/
|
*/
|
||||||
exp_len = offsetof(struct log_msg2, data) + sizeof(data);
|
exp_len = offsetof(struct log_msg, data) + sizeof(data);
|
||||||
exp_len = ROUND_UP(exp_len, Z_LOG_MSG2_ALIGNMENT) / sizeof(int);
|
exp_len = ROUND_UP(exp_len, Z_LOG_MSG2_ALIGNMENT) / sizeof(int);
|
||||||
get_msg_validate_length(exp_len);
|
get_msg_validate_length(exp_len);
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ void test_mode_size_plain_str_data(void)
|
||||||
*
|
*
|
||||||
* Message size is rounded up to the required alignment.
|
* Message size is rounded up to the required alignment.
|
||||||
*/
|
*/
|
||||||
exp_len = offsetof(struct log_msg2, data) + sizeof(data) +
|
exp_len = offsetof(struct log_msg, data) + sizeof(data) +
|
||||||
/* package */sizeof(struct cbprintf_package_hdr_ext);
|
/* package */sizeof(struct cbprintf_package_hdr_ext);
|
||||||
exp_len = ROUND_UP(exp_len, Z_LOG_MSG2_ALIGNMENT) / sizeof(int);
|
exp_len = ROUND_UP(exp_len, Z_LOG_MSG2_ALIGNMENT) / sizeof(int);
|
||||||
get_msg_validate_length(exp_len);
|
get_msg_validate_length(exp_len);
|
||||||
|
@ -483,7 +483,7 @@ void test_mode_size_str_with_strings(void)
|
||||||
*
|
*
|
||||||
* Message size is rounded up to the required alignment.
|
* Message size is rounded up to the required alignment.
|
||||||
*/
|
*/
|
||||||
exp_len = offsetof(struct log_msg2, data) +
|
exp_len = offsetof(struct log_msg, data) +
|
||||||
/* package */sizeof(struct cbprintf_package_hdr_ext) +
|
/* package */sizeof(struct cbprintf_package_hdr_ext) +
|
||||||
sizeof(const char *);
|
sizeof(const char *);
|
||||||
exp_len = ROUND_UP(exp_len, Z_LOG_MSG2_ALIGNMENT) / sizeof(int);
|
exp_len = ROUND_UP(exp_len, Z_LOG_MSG2_ALIGNMENT) / sizeof(int);
|
||||||
|
@ -525,7 +525,7 @@ void test_mode_size_str_with_2strings(void)
|
||||||
*
|
*
|
||||||
* Message size is rounded up to the required alignment.
|
* Message size is rounded up to the required alignment.
|
||||||
*/
|
*/
|
||||||
exp_len = offsetof(struct log_msg2, data) +
|
exp_len = offsetof(struct log_msg, data) +
|
||||||
/* package */sizeof(struct cbprintf_package_hdr_ext) +
|
/* package */sizeof(struct cbprintf_package_hdr_ext) +
|
||||||
2 * sizeof(const char *) + 2 + strlen(sufix);
|
2 * sizeof(const char *) + 2 + strlen(sufix);
|
||||||
|
|
||||||
|
@ -547,11 +547,11 @@ void test_saturate(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t exp_len =
|
uint32_t exp_len =
|
||||||
ROUND_UP(offsetof(struct log_msg2, data) + 2 * sizeof(void *),
|
ROUND_UP(offsetof(struct log_msg, data) + 2 * sizeof(void *),
|
||||||
Z_LOG_MSG2_ALIGNMENT);
|
Z_LOG_MSG2_ALIGNMENT);
|
||||||
uint32_t exp_capacity = (CONFIG_LOG_BUFFER_SIZE - 1) / exp_len;
|
uint32_t exp_capacity = (CONFIG_LOG_BUFFER_SIZE - 1) / exp_len;
|
||||||
int mode;
|
int mode;
|
||||||
union log_msg2_generic *msg;
|
union log_msg_generic *msg;
|
||||||
|
|
||||||
test_init();
|
test_init();
|
||||||
timestamp = 0;
|
timestamp = 0;
|
||||||
|
@ -566,29 +566,29 @@ void test_saturate(void)
|
||||||
/* Message should not fit in and be dropped. */
|
/* Message should not fit in and be dropped. */
|
||||||
Z_LOG_MSG2_CREATE3(1, mode, 0, 0, (void *)1, 2, NULL, 0, "test");
|
Z_LOG_MSG2_CREATE3(1, mode, 0, 0, (void *)1, 2, NULL, 0, "test");
|
||||||
Z_LOG_MSG2_CREATE3(0, mode, 0, 0, (void *)1, 2, NULL, 0, "test");
|
Z_LOG_MSG2_CREATE3(0, mode, 0, 0, (void *)1, 2, NULL, 0, "test");
|
||||||
z_log_msg2_runtime_create(0, (void *)1, 2, NULL, 0, 0, "test");
|
z_log_msg_runtime_create(0, (void *)1, 2, NULL, 0, 0, "test");
|
||||||
|
|
||||||
zassert_equal(z_log_dropped_read_and_clear(), 3, "No dropped messages.");
|
zassert_equal(z_log_dropped_read_and_clear(), 3, "No dropped messages.");
|
||||||
|
|
||||||
for (int i = 0; i < exp_capacity; i++) {
|
for (int i = 0; i < exp_capacity; i++) {
|
||||||
msg = z_log_msg2_claim();
|
msg = z_log_msg_claim();
|
||||||
zassert_equal(log_msg2_get_timestamp(&msg->log), i,
|
zassert_equal(log_msg_get_timestamp(&msg->log), i,
|
||||||
"Unexpected timestamp used for message id");
|
"Unexpected timestamp used for message id");
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = z_log_msg2_claim();
|
msg = z_log_msg_claim();
|
||||||
zassert_equal(msg, NULL, "Expected no pending messages");
|
zassert_equal(msg, NULL, "Expected no pending messages");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*test case main entry*/
|
/*test case main entry*/
|
||||||
void test_main(void)
|
void test_main(void)
|
||||||
{
|
{
|
||||||
ztest_test_suite(test_log_msg2,
|
ztest_test_suite(test_log_msg,
|
||||||
ztest_unit_test(test_log_msg2_0_args_msg),
|
ztest_unit_test(test_log_msg_0_args_msg),
|
||||||
ztest_unit_test(test_log_msg2_various_args),
|
ztest_unit_test(test_log_msg_various_args),
|
||||||
ztest_unit_test(test_log_msg2_only_data),
|
ztest_unit_test(test_log_msg_only_data),
|
||||||
ztest_unit_test(test_log_msg2_string_and_data),
|
ztest_unit_test(test_log_msg_string_and_data),
|
||||||
ztest_unit_test(test_log_msg2_fp),
|
ztest_unit_test(test_log_msg_fp),
|
||||||
ztest_unit_test(test_mode_size_plain_string),
|
ztest_unit_test(test_mode_size_plain_string),
|
||||||
ztest_unit_test(test_mode_size_data_only),
|
ztest_unit_test(test_mode_size_data_only),
|
||||||
ztest_unit_test(test_mode_size_plain_str_data),
|
ztest_unit_test(test_mode_size_plain_str_data),
|
||||||
|
@ -596,5 +596,5 @@ void test_main(void)
|
||||||
ztest_unit_test(test_mode_size_str_with_2strings),
|
ztest_unit_test(test_mode_size_str_with_2strings),
|
||||||
ztest_unit_test(test_saturate)
|
ztest_unit_test(test_saturate)
|
||||||
);
|
);
|
||||||
ztest_run_test_suite(test_log_msg2);
|
ztest_run_test_suite(test_log_msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,25 +8,25 @@ common:
|
||||||
integration_platforms:
|
integration_platforms:
|
||||||
- native_posix
|
- native_posix
|
||||||
tests:
|
tests:
|
||||||
logging.log_msg2:
|
logging.log_msg:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_CBPRINTF_COMPLETE=y
|
- CONFIG_CBPRINTF_COMPLETE=y
|
||||||
|
|
||||||
logging.log_msg2_no_overflow:
|
logging.log_msg_no_overflow:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_LOG_MODE_OVERFLOW=n
|
- CONFIG_LOG_MODE_OVERFLOW=n
|
||||||
|
|
||||||
logging.log_msg2_64b_timestamp:
|
logging.log_msg_64b_timestamp:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_CBPRINTF_COMPLETE=y
|
- CONFIG_CBPRINTF_COMPLETE=y
|
||||||
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
- CONFIG_LOG_TIMESTAMP_64BIT=y
|
||||||
|
|
||||||
logging.log_msg2_fp:
|
logging.log_msg_fp:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_CBPRINTF_COMPLETE=y
|
- CONFIG_CBPRINTF_COMPLETE=y
|
||||||
- CONFIG_CBPRINTF_FP_SUPPORT=y
|
- CONFIG_CBPRINTF_FP_SUPPORT=y
|
||||||
|
|
||||||
logging.log_msg2_fp_64b_timestamp:
|
logging.log_msg_fp_64b_timestamp:
|
||||||
extra_configs:
|
extra_configs:
|
||||||
- CONFIG_CBPRINTF_COMPLETE=y
|
- CONFIG_CBPRINTF_COMPLETE=y
|
||||||
- CONFIG_CBPRINTF_FP_SUPPORT=y
|
- CONFIG_CBPRINTF_FP_SUPPORT=y
|
||||||
|
|
|
@ -115,11 +115,11 @@ void test_log_switch_format_set_all_active_backends(void)
|
||||||
void test_log_switch_format_func_t_get(void)
|
void test_log_switch_format_func_t_get(void)
|
||||||
{
|
{
|
||||||
const log_format_func_t expected_values[] = {
|
const log_format_func_t expected_values[] = {
|
||||||
[LOG_OUTPUT_TEXT] = log_output_msg2_process,
|
[LOG_OUTPUT_TEXT] = log_output_msg_process,
|
||||||
[LOG_OUTPUT_SYST] = IS_ENABLED(CONFIG_LOG_MIPI_SYST_ENABLE) ?
|
[LOG_OUTPUT_SYST] = IS_ENABLED(CONFIG_LOG_MIPI_SYST_ENABLE) ?
|
||||||
log_output_msg2_syst_process : NULL,
|
log_output_msg_syst_process : NULL,
|
||||||
[LOG_OUTPUT_DICT] = IS_ENABLED(CONFIG_LOG_DICTIONARY_SUPPORT) ?
|
[LOG_OUTPUT_DICT] = IS_ENABLED(CONFIG_LOG_DICTIONARY_SUPPORT) ?
|
||||||
log_dict_output_msg2_process : NULL
|
log_dict_output_msg_process : NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
zassert_equal(log_format_table_size(), ARRAY_SIZE(expected_values),
|
zassert_equal(log_format_table_size(), ARRAY_SIZE(expected_values),
|
||||||
|
|
|
@ -46,17 +46,17 @@ void test_log_syst_format_table_selection(void)
|
||||||
|
|
||||||
log_format_func_t test_log_output_func = log_format_func_t_get(test_log_type_syst);
|
log_format_func_t test_log_output_func = log_format_func_t_get(test_log_type_syst);
|
||||||
|
|
||||||
zassert_equal_ptr(test_log_output_func, log_output_msg2_syst_process,
|
zassert_equal_ptr(test_log_output_func, log_output_msg_syst_process,
|
||||||
"Correct Function pointer for SYST log\n"
|
"Correct Function pointer for SYST log\n"
|
||||||
"format was not selected %p vs %p",
|
"format was not selected %p vs %p",
|
||||||
test_log_output_func, log_output_msg2_syst_process);
|
test_log_output_func, log_output_msg_syst_process);
|
||||||
|
|
||||||
#elif CONFIG_LOG_BACKEND_MOCK_OUTPUT_DEFAULT == LOG_OUTPUT_TEXT
|
#elif CONFIG_LOG_BACKEND_MOCK_OUTPUT_DEFAULT == LOG_OUTPUT_TEXT
|
||||||
|
|
||||||
uint32_t test_log_type_text = LOG_OUTPUT_TEXT;
|
uint32_t test_log_type_text = LOG_OUTPUT_TEXT;
|
||||||
log_format_func_t test_log_output_func = log_format_func_t_get(test_log_type_text);
|
log_format_func_t test_log_output_func = log_format_func_t_get(test_log_type_text);
|
||||||
|
|
||||||
zassert_equal_ptr(test_log_output_func, log_output_msg2_process,
|
zassert_equal_ptr(test_log_output_func, log_output_msg_process,
|
||||||
"Function pointer for TEXT log format was not selected");
|
"Function pointer for TEXT log format was not selected");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static uint32_t log_format_current = CONFIG_LOG_BACKEND_MOCK_OUTPUT_DEFAULT;
|
static uint32_t log_format_current = CONFIG_LOG_BACKEND_MOCK_OUTPUT_DEFAULT;
|
||||||
union log_msg2_generic *test_msg;
|
union log_msg_generic *test_msg;
|
||||||
|
|
||||||
static uint8_t mock_output_buf[1];
|
static uint8_t mock_output_buf[1];
|
||||||
uint8_t test_output_buf[256];
|
uint8_t test_output_buf[256];
|
||||||
|
@ -43,7 +43,7 @@ static int char_out(uint8_t *data, size_t length, void *ctx)
|
||||||
LOG_OUTPUT_DEFINE(log_output_mock, char_out, mock_output_buf, sizeof(mock_output_buf));
|
LOG_OUTPUT_DEFINE(log_output_mock, char_out, mock_output_buf, sizeof(mock_output_buf));
|
||||||
|
|
||||||
static void process(const struct log_backend *const backend,
|
static void process(const struct log_backend *const backend,
|
||||||
union log_msg2_generic *msg)
|
union log_msg_generic *msg)
|
||||||
{
|
{
|
||||||
uint32_t flags = log_backend_std_get_flags();
|
uint32_t flags = log_backend_std_get_flags();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue