1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2020 Intel Corporation. All rights reserved.
4  *
5  * Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
6  */
7 
8 #ifndef __USER_TDFB_H__
9 #define __USER_TDFB_H__
10 
11 #include <stdint.h>
12 
13 #define SOF_TDFB_MAX_SIZE 4096		/* Max size for coef data in bytes */
14 #define SOF_TDFB_FIR_MAX_LENGTH 256	/* Max length for individual filter */
15 #define SOF_TDFB_FIR_MAX_COUNT 16	/* A blob can define max 16 FIR EQs */
16 #define SOF_TDFB_MAX_STREAMS 8		/* Support 1..8 sinks */
17 #define SOF_TDFB_MAX_ANGLES 360		/* Up to 1 degree precision for 360 degrees coverage */
18 #define SOF_TDFB_MAX_MICROPHONES 16	/* Up to 16 microphone locations */
19 
20 /*
21  * sof_tdfb_config data[]
22 
23  * int16_t fir_filter1[length_filter1];  Multiple of 4 taps and 32 bit align
24  * int16_t fir_filter2[length_filter2];  Multiple of 4 taps and 32 bit align
25  *		...
26  * int16_t fir_filterN[length_filterN];  Multiple of 4 taps and 32 bit align
27  * int16_t input_channel_select[num_filters];  0 = ch0, 1 = 1ch1, ..
28  * int16_t output_channel_mix[num_filters];
29  * int16_t output_stream_mix[num_filters];
30  *
31  */
32 
33 struct sof_tdfb_config {
34 	uint32_t size;			/* Size of entire struct */
35 	uint16_t num_filters;		/* Total number of filters */
36 	uint16_t num_output_channels;   /* Total number of output channels */
37 	uint16_t num_output_streams;	/* one source, N output sinks */
38 
39 	/* Since ABI version 3.19 */
40 	uint16_t num_mic_locations;	/* Number of microphones locations entries */
41 	uint16_t num_angles;		/* Number of steer angles in data, not counting beam off */
42 	uint16_t beam_off_defined;	/* Set if a beam off filters configuration is present */
43 	uint16_t track_doa;		/* Track direction of arrival angle */
44 	int16_t angle_enum_mult;	/* Multiply enum value (0..15) to get angle in degrees */
45 	int16_t angle_enum_offs;	/* After multiplication add this degrees offset to angle */
46 
47 	/* reserved */
48 	uint16_t reserved16;		/* To keep data 32 bit aligned */
49 	uint32_t reserved32[1];		/* For future */
50 
51 	int16_t data[];
52 } __attribute__((packed));
53 
54 struct sof_tdfb_angle {
55 	int16_t azimuth;	/* Beam polar azimuth angle -180 to +180 degrees Q15.0 */
56 	int16_t elevation;	/* Beam polar elevation angle -90 to +90 degrees Q15.0 */
57 	int16_t filter_index;	/* Index of first filter for the filter bank for this beam angle */
58 	int16_t reserved;	/* For future */
59 } __attribute__((packed));
60 
61 struct sof_tdfb_mic_location {
62 	int16_t x;		/* Microphone x coordinate as Q4.12 meters */
63 	int16_t y;		/* Microphone y coordinate as Q4.12 meters */
64 	int16_t z;		/* Microphone z coordinate as Q4.12 meters */
65 	int16_t reserved;	/* For future */
66 } __attribute__((packed));
67 
68 #endif /* __USER_TDFB_H__ */
69