|
| 1 | +/* |
| 2 | + * Copyright (c) 2021 Nordic Semiconductor ASA |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | +#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_CORE2_H_ |
| 7 | +#define ZEPHYR_INCLUDE_LOGGING_LOG_CORE2_H_ |
| 8 | + |
| 9 | +#include <logging/log_msg2.h> |
| 10 | + |
| 11 | +#ifdef __cplusplus |
| 12 | +extern "C" { |
| 13 | +#endif |
| 14 | + |
| 15 | +#define Z_TRACING_LOG_TRACE(id) do { \ |
| 16 | + Z_TRACING_LOG_HDR_INIT(_msg, id); \ |
| 17 | + z_log_msg2_put_trace(_msg); \ |
| 18 | +} while (0) |
| 19 | + |
| 20 | +#define Z_TRACING_LOG_TRACE_PTR(id, ptr) do { \ |
| 21 | + Z_TRACING_LOG_HDR_INIT(_msg, id); \ |
| 22 | + z_log_msg2_put_trace_ptr(_msg, ptr); \ |
| 23 | +} while (0) |
| 24 | + |
| 25 | +void z_log_msg2_put_trace(struct log_msg2_trace trace); |
| 26 | + |
| 27 | +void z_log_msg2_put_trace_ptr(struct log_msg2_trace hdr, void *data); |
| 28 | + |
| 29 | + |
| 30 | +/** @brief Initialize module for handling logging message. */ |
| 31 | +void z_log_msg2_init(void); |
| 32 | + |
| 33 | +/** @brief Allocate log message. |
| 34 | + * |
| 35 | + * @param wlen Length in 32 bit words. |
| 36 | + * |
| 37 | + * @return allocated space or null if cannot be allocated. |
| 38 | + */ |
| 39 | +struct log_msg2 *z_log_msg2_alloc(uint32_t wlen); |
| 40 | + |
| 41 | +/** @brief Commit log message. |
| 42 | + * |
| 43 | + * @param msg Message. |
| 44 | + */ |
| 45 | +void z_log_msg2_commit(struct log_msg2 *msg); |
| 46 | + |
| 47 | +/** @brief Get pending log message. |
| 48 | + * |
| 49 | + * @param[out] len Message length in bytes is written is @p len is not null. |
| 50 | + * |
| 51 | + * @param Message or null if no pending messages. |
| 52 | + */ |
| 53 | +union log_msg2_generic *z_log_msg2_claim(void); |
| 54 | + |
| 55 | +/** @brief Free message. |
| 56 | + * |
| 57 | + * @param msg Message. |
| 58 | + */ |
| 59 | +void z_log_msg2_free(union log_msg2_generic *msg); |
| 60 | + |
| 61 | +/** @brief Check if there are any message pending. |
| 62 | + * |
| 63 | + * @retval true if at least one message is pending. |
| 64 | + * @retval false if no message is pending. |
| 65 | + */ |
| 66 | +bool z_log_msg2_pending(void); |
| 67 | + |
| 68 | +#ifdef __cplusplus |
| 69 | +} |
| 70 | +#endif |
| 71 | + |
| 72 | +#endif /* ZEPHYR_INCLUDE_LOGGING_LOG_CORE2_H_ */ |
0 commit comments