1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /*
3  * This file is provided under a dual BSD/GPLv2 license.  When using or
4  * redistributing this file, you may do so under either license.
5  *
6  * Copyright(c) 2019-2020 Intel Corporation. All rights reserved.
7  *
8  * Author: Cezary Rojewski <cezary.rojewski@intel.com>
9  */
10 
11 #ifndef __SOF_PROBE_H
12 #define __SOF_PROBE_H
13 
14 #include <sound/sof/header.h>
15 
16 struct snd_sof_dev;
17 
18 #define SOF_PROBE_INVALID_NODE_ID UINT_MAX
19 
20 struct sof_probe_dma {
21 	unsigned int stream_tag;
22 	unsigned int dma_buffer_size;
23 } __packed;
24 
25 enum sof_connection_purpose {
26 	SOF_CONNECTION_PURPOSE_EXTRACT = 1,
27 	SOF_CONNECTION_PURPOSE_INJECT,
28 };
29 
30 struct sof_probe_point_desc {
31 	unsigned int buffer_id;
32 	unsigned int purpose;
33 	unsigned int stream_tag;
34 } __packed;
35 
36 struct sof_ipc_probe_dma_add_params {
37 	struct sof_ipc_cmd_hdr hdr;
38 	unsigned int num_elems;
39 	struct sof_probe_dma dma[];
40 } __packed;
41 
42 struct sof_ipc_probe_info_params {
43 	struct sof_ipc_reply rhdr;
44 	unsigned int num_elems;
45 	union {
46 		struct sof_probe_dma dma[0];
47 		struct sof_probe_point_desc desc[0];
48 	};
49 } __packed;
50 
51 struct sof_ipc_probe_dma_remove_params {
52 	struct sof_ipc_cmd_hdr hdr;
53 	unsigned int num_elems;
54 	unsigned int stream_tag[];
55 } __packed;
56 
57 struct sof_ipc_probe_point_add_params {
58 	struct sof_ipc_cmd_hdr hdr;
59 	unsigned int num_elems;
60 	struct sof_probe_point_desc desc[];
61 } __packed;
62 
63 struct sof_ipc_probe_point_remove_params {
64 	struct sof_ipc_cmd_hdr hdr;
65 	unsigned int num_elems;
66 	unsigned int buffer_id[];
67 } __packed;
68 
69 int sof_ipc_probe_init(struct snd_sof_dev *sdev,
70 		u32 stream_tag, size_t buffer_size);
71 int sof_ipc_probe_deinit(struct snd_sof_dev *sdev);
72 int sof_ipc_probe_dma_info(struct snd_sof_dev *sdev,
73 		struct sof_probe_dma **dma, size_t *num_dma);
74 int sof_ipc_probe_dma_add(struct snd_sof_dev *sdev,
75 		struct sof_probe_dma *dma, size_t num_dma);
76 int sof_ipc_probe_dma_remove(struct snd_sof_dev *sdev,
77 		unsigned int *stream_tag, size_t num_stream_tag);
78 int sof_ipc_probe_points_info(struct snd_sof_dev *sdev,
79 		struct sof_probe_point_desc **desc, size_t *num_desc);
80 int sof_ipc_probe_points_add(struct snd_sof_dev *sdev,
81 		struct sof_probe_point_desc *desc, size_t num_desc);
82 int sof_ipc_probe_points_remove(struct snd_sof_dev *sdev,
83 		unsigned int *buffer_id, size_t num_buffer_id);
84 
85 #endif
86