1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2019 Intel Corporation. All rights reserved.
4  *
5  * Author: Marcin Maka <marcin.maka@linux.intel.com>
6  *         Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
7  */
8 
9 #ifndef __IPC_CHANNEL_MAP_H__
10 #define __IPC_CHANNEL_MAP_H__
11 
12 #include <ipc/header.h>
13 #include <sof/compiler_attributes.h>
14 #include <stdint.h>
15 
16 /**
17  * \brief Channel map, specifies transformation of one-to-many or many-to-one.
18  *
19  * In case of one-to-many specifies how the output channels are computed out of
20  * a single source channel,
21  * in case of many-to-one specifies how a single target channel is computed
22  * from a multichannel input stream.
23  *
24  * Channel index specifies position of the channel in the stream on the 'one'
25  * side.
26  *
27  * Ext ID is the identifier of external part of the transformation. Depending
28  * on the context, it may be pipeline ID, dai ID, ...
29  *
30  * Channel mask describes which channels are taken into account on the "many"
31  * side. Bit[i] set to 1 means that i-th channel is used for computation
32  * (either as source or as a target).
33  *
34  * Channel mask is followed by array of coefficients in Q2.30 format,
35  * one per each channel set in the mask (left to right, LS bit set in the
36  * mask corresponds to ch_coeffs[0]).
37  */
38 struct sof_ipc_channel_map {
39 	uint32_t ch_index;
40 	uint32_t ext_id;
41 	uint32_t ch_mask;
42 	uint32_t reserved;
43 	int32_t ch_coeffs[0];
44 } __attribute__((packed, aligned(4)));
45 
46 /**
47  * \brief Complete map for each channel of a multichannel stream.
48  *
49  * num_ch_map Specifies number of items in the ch_map.
50  * More than one transformation per a single channel is allowed (in case
51  * multiple external entities are transformed).
52  * A channel may be skipped in the transformation list, then it is filled
53  * with 0's by the transformation function.
54  */
55 struct sof_ipc_stream_map {
56 	struct sof_ipc_cmd_hdr hdr;
57 	uint32_t num_ch_map;
58 	uint32_t reserved[3];
59 	struct sof_ipc_channel_map ch_map[0];
60 } __attribute__((packed, aligned(4)));
61 
62 #endif /* __IPC_CHANNEL_MAP_H__ */
63