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 <sof/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 */
19 extern 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 #define pipe_err(pipe_p, __e, ...)					\
41 	trace_dev_err(trace_pipe_get_tr_ctx, trace_pipe_get_id,		\
42 		      trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__)
43 
44 #define pipe_warn(pipe_p, __e, ...)					\
45 	trace_dev_warn(trace_pipe_get_tr_ctx, trace_pipe_get_id,	\
46 		       trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__)
47 
48 #define pipe_info(pipe_p, __e, ...)					\
49 	trace_dev_info(trace_pipe_get_tr_ctx, trace_pipe_get_id,	\
50 		       trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__)
51 
52 #define pipe_dbg(pipe_p, __e, ...)					\
53 	trace_dev_dbg(trace_pipe_get_tr_ctx, trace_pipe_get_id,		\
54 		      trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__)
55 
56 #endif
57