Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
log_frontend_stmesp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_FRONTEND_STMESP_H_
14#define ZEPHYR_INCLUDE_LOGGING_LOG_FRONTEND_STMESP_H_
15
16#include <errno.h>
17#include <zephyr/types.h>
18#ifdef CONFIG_LOG_FRONTEND_STMESP
20#endif
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
32
44
51
57
65static inline void log_frontend_stmesp_tp(uint16_t x)
66{
67#ifdef CONFIG_LOG_FRONTEND_STMESP
68 STMESP_Type *port;
69 int err = stmesp_get_port((uint32_t)x + CONFIG_LOG_FRONTEND_STMESP_TP_CHAN_BASE, &port);
70
71 __ASSERT_NO_MSG(err == 0);
72 if (err == 0) {
73 stmesp_flag(port, 1, true,
74 IS_ENABLED(CONFIG_LOG_FRONTEND_STMESP_GUARANTEED_ACCESS));
75 }
76#endif
77}
78
88{
89#ifdef CONFIG_LOG_FRONTEND_STMESP
90 STMESP_Type *port;
91 int err = stmesp_get_port((uint32_t)x + CONFIG_LOG_FRONTEND_STMESP_TP_CHAN_BASE, &port);
92
93 __ASSERT_NO_MSG(err == 0);
94 if (err == 0) {
95 stmesp_data32(port, d, true, true,
96 IS_ENABLED(CONFIG_LOG_FRONTEND_STMESP_GUARANTEED_ACCESS));
97 }
98#endif
99}
100
106void log_frontend_stmesp_log0(const void *source, uint32_t x);
107
114void log_frontend_stmesp_log1(const void *source, uint32_t x, uint32_t arg);
115
117TYPE_SECTION_START_EXTERN(const char *, log_stmesp_ptr);
119
125
126#define LOG_FRONTEND_STMESP_LOG0(_source, ...) \
127 do { \
128 static const char _str[] __in_section(_log_stmesp_str, static, __COUNTER__) \
129 __used __noasan __aligned(sizeof(uint32_t)) = GET_ARG_N(1, __VA_ARGS__); \
130 static const char *str_ptr __in_section(_log_stmesp_ptr, static, __COUNTER__) \
131 __used __noasan = _str; \
132 uint32_t _idx = \
133 ((uintptr_t)&str_ptr - (uintptr_t)TYPE_SECTION_START(log_stmesp_ptr)) / \
134 sizeof(void *); \
135 log_frontend_stmesp_log0(_source, _idx); \
136 } while (0)
137
143#define LOG_FRONTEND_STMESP_LOG1(_source, ...) \
144 do { \
145 static const char _str[] __in_section(_log_stmesp_str, static, __COUNTER__) \
146 __used __noasan __aligned(sizeof(uint32_t)) = GET_ARG_N(1, __VA_ARGS__); \
147 static const char *str_ptr __in_section(_log_stmesp_ptr, static, __COUNTER__) \
148 __used __noasan = _str; \
149 uint32_t _idx = \
150 ((uintptr_t)&str_ptr - (uintptr_t)TYPE_SECTION_START(log_stmesp_ptr)) / \
151 sizeof(void *); \
152 log_frontend_stmesp_log1(_source, _idx, (uintptr_t)(GET_ARG_N(2, __VA_ARGS__))); \
153 } while (0)
154
156
157#ifdef __cplusplus
158}
159#endif
160
161#endif /* ZEPHYR_INCLUDE_LOGGING_LOG_FRONTEND_STMESP_H_ */
System error numbers.
#define TYPE_SECTION_START_EXTERN(type, secname)
iterable section extern for start symbol for a generic type
Definition iterable_sections.h:84
static void log_frontend_stmesp_tp_d32(uint16_t x, uint32_t d)
Trace point with 32 bit data.
Definition log_frontend_stmesp.h:87
void log_frontend_stmesp_log1(const void *source, uint32_t x, uint32_t arg)
Function called for log message with one argument when turbo logging is enabled.
static void log_frontend_stmesp_tp(uint16_t x)
Trace point.
Definition log_frontend_stmesp.h:65
void log_frontend_stmesp_dummy_write(void)
Perform a dummy write to STMESP.
void log_frontend_stmesp_pre_sleep(void)
Hook to be called before going to sleep.
void log_frontend_stmesp_log0(const void *source, uint32_t x)
Function called for log message with no arguments when turbo logging is enabled.
int log_frontend_stmesp_etr_ready(void)
Notify frontend that ETR/STM is ready.
static void stmesp_flag(STMESP_Type *reg, uint32_t data, bool ts, bool guaranteed)
Write flag to STMESP.
Definition stmesp.h:99
static int stmesp_get_port(uint32_t idx, STMESP_Type **port)
Return address of a STM extended stimulus port.
Definition stmesp.h:169
static void stmesp_data32(STMESP_Type *reg, uint32_t data, bool ts, bool marked, bool guaranteed)
Write 32 bit data to STMESP.
Definition stmesp.h:152
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:154
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT16_TYPE__ uint16_t
Definition stdint.h:89