1 // SPDX-License-Identifier: BSD-3-Clause 2 // 3 // Copyright(c) 2021 Intel Corporation. All rights reserved. 4 // 5 // Author: Jaska Uimonen <jaska.uimonen@linux.intel.com> 6 7 #ifndef __INTEL_NHLT_H 8 #define __INTEL_NHLT_H 9 10 #include <stdint.h> 11 #include <errno.h> 12 #include <stdio.h> 13 #include <stdlib.h> 14 #include <string.h> 15 #include <alsa/input.h> 16 #include <alsa/output.h> 17 #include <alsa/conf.h> 18 #include <alsa/error.h> 19 20 #define MIN(a, b) ({ \ 21 typeof(a) __a = (a); \ 22 typeof(b) __b = (b); \ 23 __a > __b ? __b : __a; \ 24 }) 25 #define MAX(a, b) ({ \ 26 typeof(a) __a = (a); \ 27 typeof(b) __b = (b); \ 28 __a < __b ? __b : __a; \ 29 }) 30 31 #define ARRAY_SIZE(a) (sizeof (a) / sizeof (a)[0]) 32 33 #define BIT(b) (1UL << (b)) 34 #define MASK(b_hi, b_lo) (((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL) << (b_lo)) 35 #define SET_BIT(b, x) (((x) & 1) << (b)) 36 #define SET_BITS(b_hi, b_lo, x) (((x) & ((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL)) << (b_lo)) 37 38 struct intel_nhlt_params { 39 void *dmic_params; 40 void *ssp_params; 41 }; 42 43 struct dai_values { 44 char name[32]; 45 snd_config_type_t type; 46 snd_config_t *data; 47 long *int_val; 48 const char **string_val; 49 }; 50 51 int find_set_values(struct dai_values *values, int size, snd_config_t *dai_cfg, 52 snd_config_t *top, const char *class_name); 53 54 #endif /* __INTEL_NHLT_H */ 55