Sound Open Firmware
Loading...
Searching...
No Matches
pipeline-trace.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2016 Intel Corporation. All rights reserved.
4 *
5 * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
6 */
7
8#ifndef __SOF_AUDIO_PIPELINE_TRACE_H__
9#define __SOF_AUDIO_PIPELINE_TRACE_H__
10
11#include <rtos/sof.h>
12#include <sof/trace/trace.h>
13#include <user/trace.h>
14#include <errno.h>
15#include <stdbool.h>
16#include <stdint.h>
17
18/* pipeline tracing */
19extern struct tr_ctx pipe_tr;
20
21#define trace_pipe_get_tr_ctx(pipe_p) (&(pipe_p)->tctx)
22#define trace_pipe_get_id(pipe_p) ((pipe_p)->pipeline_id)
23#define trace_pipe_get_subid(pipe_p) ((pipe_p)->comp_id)
24
25/* class (driver) level (no device object) tracing */
26
27#define pipe_cl_err(__e, ...) \
28 tr_err(&pipe_tr, __e, ##__VA_ARGS__)
29
30#define pipe_cl_warn(__e, ...) \
31 tr_warn(&pipe_tr, __e, ##__VA_ARGS__)
32
33#define pipe_cl_info(__e, ...) \
34 tr_info(&pipe_tr, __e, ##__VA_ARGS__)
35
36#define pipe_cl_dbg(__e, ...) \
37 tr_dbg(&pipe_tr, __e, ##__VA_ARGS__)
38
39/* device tracing */
40#if defined(__ZEPHYR__) && defined(CONFIG_ZEPHYR_LOG)
41
42#if CONFIG_IPC_MAJOR_4
43#define __PIPE_FMT "pipe:%u %#x "
44#else
45#define __PIPE_FMT "pipe:%u.%u "
46#endif
47
48#define pipe_err(pipe_p, __e, ...) LOG_ERR(__PIPE_FMT __e, trace_pipe_get_id(pipe_p), \
49 trace_pipe_get_subid(pipe_p), ##__VA_ARGS__)
50
51#define pipe_warn(pipe_p, __e, ...) LOG_WRN(__PIPE_FMT __e, trace_pipe_get_id(pipe_p), \
52 trace_pipe_get_subid(pipe_p), ##__VA_ARGS__)
53
54#define pipe_info(pipe_p, __e, ...) LOG_INF(__PIPE_FMT __e, trace_pipe_get_id(pipe_p), \
55 trace_pipe_get_subid(pipe_p), ##__VA_ARGS__)
56
57#define pipe_dbg(pipe_p, __e, ...) LOG_DBG(__PIPE_FMT __e, trace_pipe_get_id(pipe_p), \
58 trace_pipe_get_subid(pipe_p), ##__VA_ARGS__)
59
60#else
61
62#if defined(__ZEPHYR__) && defined(CONFIG_SOF_USERSPACE_LL)
63#error "Invalid build config: User-space cannot access trace context."
64#endif
65
66#define pipe_err(pipe_p, __e, ...) \
67 trace_dev_err(trace_pipe_get_tr_ctx, trace_pipe_get_id, \
68 trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__)
69
70#define pipe_warn(pipe_p, __e, ...) \
71 trace_dev_warn(trace_pipe_get_tr_ctx, trace_pipe_get_id, \
72 trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__)
73
74#define pipe_info(pipe_p, __e, ...) \
75 trace_dev_info(trace_pipe_get_tr_ctx, trace_pipe_get_id, \
76 trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__)
77
78#define pipe_dbg(pipe_p, __e, ...) \
79 trace_dev_dbg(trace_pipe_get_tr_ctx, trace_pipe_get_id, \
80 trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__)
81
82#endif /* #if defined(__ZEPHYR__) && defined(CONFIG_ZEPHYR_LOG) */
83
84#endif
struct tr_ctx pipe_tr
Definition trace.h:135