Sound Open Firmware
Loading...
Searching...
No Matches
trace.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// Copyright(c) 2020 Intel Corporation. All rights reserved.
4//
5
6#ifndef __SOF_TRACE_TRACE1_H__
7#define __SOF_TRACE_TRACE1_H__
8
9#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_H_
10#include <zephyr/logging/log.h>
11#include <zephyr/sys/printk.h>
12
13/* Level of SOF trace on Zephyr */
14#define SOF_ZEPHYR_TRACE_LEVEL LOG_LEVEL_INF
15
16#endif
17
18/* printk supports uint64_t so use it until LOG is ready */
19#define USE_PRINTK 1
20
21/* SOF trace header */
22#include "../../../../src/include/sof/trace/trace.h"
23
24struct timer;
30uint64_t platform_timer_get(struct timer *timer);
31
32/*
33 * Override SOF mtrace_printf() macro for now to support Zephyr's shared
34 * memory logger. Note the DMA trace can be copied to the shared memory
35 * too thanks to CONFIG_TRACEM.
36 */
37#undef mtrace_printf
38
39#if USE_PRINTK
40#define mtrace_printf(level, format, ...) \
41 do { \
42 if ((level) <= SOF_ZEPHYR_TRACE_LEVEL) \
43 printk("%llu: " format "\n", sof_cycle_get_64(), \
44 ##__VA_ARGS__); \
45 } while (0)
46#else
47#error "TODO: Z_LOG()"
48#endif
49
50#endif /* __INCLUDE_TRACE__ */
uint64_t platform_timer_get(struct timer *timer)
Get high-resolution 64-bit hardware timer value for trace timestamping.