1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2018 Intel Corporation. All rights reserved.
4  *
5  * Author: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
6  *         Artur Kloniecki <arturx.kloniecki@linux.intel.com>
7  */
8 
9 #ifndef __USER_TRACE_H__
10 #define __USER_TRACE_H__
11 
12 #include <stdint.h>
13 
14 /* trace event classes - high 8 bits*/
15 #define TRACE_CLASS_DEPRECATED	(0)
16 
17 #define LOG_ENABLE		1  /* Enable logging */
18 #define LOG_DISABLE		0  /* Disable logging */
19 
20 #define LOG_LEVEL_CRITICAL	1  /* (FDK fatal) */
21 #define LOG_LEVEL_ERROR		LOG_LEVEL_CRITICAL
22 #define LOG_LEVEL_WARNING	2
23 #define LOG_LEVEL_INFO		3
24 #define LOG_LEVEL_DEBUG		4
25 #define LOG_LEVEL_VERBOSE	LOG_LEVEL_DEBUG
26 
27 #define TRACE_ID_LENGTH 12 /* bit field length */
28 
29 /*
30  *  Log entry protocol header.
31  *
32  * The header is followed by an array of arguments (uint32_t[]).
33  * Number of arguments is specified by the params_num field of log_entry
34  */
35 struct log_entry_header {
36 	uint32_t uid;
37 	uint32_t id_0 : TRACE_ID_LENGTH; /* e.g. Pipeline ID */
38 	uint32_t id_1 : TRACE_ID_LENGTH; /* e.g. Component ID */
39 	uint32_t core_id : 8;		 /* Reporting core's id */
40 
41 	uint64_t timestamp;		 /* Timestamp (in dsp ticks) */
42 	uint32_t log_entry_address;	 /* Address of log entry in ELF */
43 } __attribute__((packed));
44 
45 #endif /* __USER_TRACE_H__ */
46