1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2019 Intel Corporation. All rights reserved.
4  *
5  * Author: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
6  */
7 
8 #ifndef __SOF_PROBE_PROBE_H__
9 #define __SOF_PROBE_PROBE_H__
10 
11 #if CONFIG_PROBE
12 
13 #include <ipc/probe.h>
14 
15 /*
16  * \brief Initialize probes subsystem
17  *
18  * param[in,optional] extraction_probe_dma - DMA associated with extraction
19  *		      In case extraction_probe_dma is NULL, extraction probes
20  *		      are unavailable.
21  */
22 int probe_init(struct probe_dma *extraction_probe_dma);
23 
24 /*
25  * \brief Deinitialize probes subsystem.
26  *
27  * Detach extraction DMA if was enabled. Return -EINVAL in case some probes
28  * are still in use.
29  */
30 int probe_deinit(void);
31 
32 /*
33  * \brief Setup injection DMAs for probes.
34  *
35  * param[in] count - number of DMAs configured during this call
36  * param[in] probe_dma - Array of size 'count' with configuration data for DMAs
37  */
38 int probe_dma_add(uint32_t count, struct probe_dma *probe_dma);
39 
40 /*
41  * \brief Get info about connected injection DMAs
42  *
43  * param[in,out] data - reply to write data to
44  * param[in] max_size - maximum number of bytes available in data
45  */
46 int probe_dma_info(struct sof_ipc_probe_info_params *data, uint32_t max_size);
47 
48 /*
49  * \brief Remove injection DMAs
50  *
51  * param[in] count - number of DMAs removed during this call
52  * param[in] stream_tag - array for size 'count' with stream tags associated
53  *			  with DMAs to be removed
54  */
55 int probe_dma_remove(uint32_t count, uint32_t *stream_tag);
56 
57 /*
58  * \brief Set probe points
59  *
60  * param[in] count - number of probe points configured this call
61  * param[in] probe - array of size 'count' with configuration of probe points
62  */
63 int probe_point_add(uint32_t count, struct probe_point *probe);
64 
65 /*
66  * \brief Get info about connected probe points
67  *
68  * param[in,out] data - reply to write data to
69  * param[in] max_size - maximum number of bytes available in data
70  */
71 int probe_point_info(struct sof_ipc_probe_info_params *data, uint32_t max_size);
72 
73 /*
74  * \brief Remove probe points
75  *
76  * param[in] count - number of probe points removed this call
77  * param[in] buffer_id - array of size 'count' with IDs of buffers to which
78  *			 probes were attached
79  */
80 int probe_point_remove(uint32_t count, uint32_t *buffer_id);
81 
82 /**
83  * \brief Retrieves probes structure.
84  * \return Pointer to probes structure.
85  */
probe_get(void)86 static inline struct probe_pdata *probe_get(void)
87 {
88 	return sof_get()->probe;
89 }
90 
91 #endif /* CONFIG_PROBE */
92 
93 #endif /* __SOF_PROBE_PROBE_H__ */
94