1 /*
2  * Copyright (c) 2019 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef LOG_FRONTEND_H_
7 #define LOG_FRONTEND_H_
8 
9 #include <zephyr/logging/log_core.h>
10 
11 /** @brief Initialize frontend.
12  */
13 void log_frontend_init(void);
14 
15 /** @brief Log generic message.
16  *
17  * Message details does not contain timestamp. Since function is called in the
18  * context of log message call, implementation can use its own timestamping scheme.
19  *
20  * @param source Pointer to a structure associated with given source. It points to
21  * static structure or dynamic structure if runtime filtering is enabled.
22  * @ref log_const_source_id or @ref log_dynamic_source_id can be used to determine
23  * source id.
24  *
25  * @param desc Message descriptor.
26  *
27  * @param package Cbprintf package containing logging formatted string. Length s in @p desc.
28  *
29  * @param data Hexdump data. Length is in @p desc.
30  */
31 void log_frontend_msg(const void *source,
32 		      const struct log_msg_desc desc,
33 		      uint8_t *package, const void *data);
34 
35 /** @brief Log message with 0 arguments.
36  *
37  * Optimized version for log message which does not have arguments (only string).
38  * This API is optional and is used only if optimizing common log messages is enabled.
39  *
40  * @param source Pointer to a structure associated with given source. It points to
41  * static structure or dynamic structure if runtime filtering is enabled.
42  * @ref log_const_source_id or @ref log_dynamic_source_id can be used to determine
43  * source id.
44  * @param level Severity level.
45  * @param fmt  String.
46  */
47 void log_frontend_simple_0(const void *source, uint32_t level, const char *fmt);
48 
49 /** @brief Log message with 1 argument.
50  *
51  * Optimized version for log message which has one argument that fits in a 32 bit word.
52  * This API is optional and is used only if optimizing common log messages is enabled.
53  *
54  * @param source Pointer to a structure associated with given source. It points to
55  * static structure or dynamic structure if runtime filtering is enabled.
56  * @ref log_const_source_id or @ref log_dynamic_source_id can be used to determine
57  * source id.
58  * @param level Severity level.
59  * @param fmt  String.
60  * @param arg  Argument passed to the string.
61  */
62 void log_frontend_simple_1(const void *source, uint32_t level, const char *fmt, uint32_t arg);
63 
64 /** @brief Log message with 2 arguments.
65  *
66  * Optimized version for log message which has two arguments that fit in a 32 bit word.
67  * This API is optional and is used only if optimizing common log messages is enabled.
68  *
69  * @param source Pointer to a structure associated with given source. It points to
70  * static structure or dynamic structure if runtime filtering is enabled.
71  * @ref log_const_source_id or @ref log_dynamic_source_id can be used to determine
72  * source id.
73  * @param level Severity level.
74  * @param fmt   String.
75  * @param arg0  First argument passed to the string.
76  * @param arg1  Second argument passed to the string.
77  */
78 void log_frontend_simple_2(const void *source, uint32_t level,
79 			   const char *fmt, uint32_t arg0, uint32_t arg1);
80 
81 /** @brief Panic state notification. */
82 void log_frontend_panic(void);
83 
84 #endif /* LOG_FRONTEND_H_ */
85