1divert(-1)
2
3include(`debug.m4')
4
5dnl Define macros for DAI IN/OUT widgets and DAI config
6DECLARE_SOF_RT_UUID("dai", dai_comp_uuid, 0xc2b00d27, 0xffbc, 0x4150,
7		 0xa5, 0x1a, 0x24, 0x5c, 0x79, 0xc5, 0xe5, 0x4b)
8
9dnl N_DAI(name)
10define(`N_DAI', DAI_NAME)
11define(`N_DAI_OUT', DAI_NAME`.OUT')
12define(`N_DAI_IN', DAI_NAME`.IN')
13
14dnl W_DAI_OUT(type, index, dai_link, format, periods_sink, periods_source, core)
15define(`W_DAI_OUT',
16`SectionVendorTuples."'N_DAI_OUT`_tuples_uuid" {'
17`	tokens "sof_comp_tokens"'
18`	tuples."uuid" {'
19`		SOF_TKN_COMP_UUID'		STR(dai_comp_uuid)
20`	}'
21`}'
22`SectionData."'N_DAI_OUT`_data_uuid" {'
23`	tuples "'N_DAI_OUT`_tuples_uuid"'
24`}'
25`SectionVendorTuples."'N_DAI_OUT`_tuples_w_comp" {'
26`	tokens "sof_comp_tokens"'
27`	tuples."word" {'
28`		SOF_TKN_COMP_PERIOD_SINK_COUNT'		STR($5)
29`		SOF_TKN_COMP_PERIOD_SOURCE_COUNT'	STR($6)
30`		SOF_TKN_COMP_CORE_ID'			STR($7)
31`	}'
32`}'
33`SectionData."'N_DAI_OUT`_data_w_comp" {'
34`	tuples "'N_DAI_OUT`_tuples_w_comp"'
35`}'
36`SectionVendorTuples."'N_DAI_OUT`_tuples_w" {'
37`	tokens "sof_dai_tokens"'
38`	tuples."word" {'
39`		SOF_TKN_DAI_INDEX'	$2
40`		SOF_TKN_DAI_DIRECTION'	"0"
41`	}'
42`}'
43`SectionData."'N_DAI_OUT`_data_w" {'
44`	tuples "'N_DAI_OUT`_tuples_w"'
45`}'
46`SectionVendorTuples."'N_DAI_OUT`_tuples_str" {'
47`	tokens "sof_dai_tokens"'
48`	tuples."string" {'
49`		SOF_TKN_DAI_TYPE'	$1
50`	}'
51`}'
52`SectionData."'N_DAI_OUT`_data_str" {'
53`	tuples "'N_DAI_OUT`_tuples_str"'
54`}'
55`SectionVendorTuples."'N_DAI_OUT`_tuples_comp_str" {'
56`	tokens "sof_comp_tokens"'
57`	tuples."string" {'
58`		SOF_TKN_COMP_FORMAT'	STR($4)
59`	}'
60`}'
61`SectionData."'N_DAI_OUT`_data_comp_str" {'
62`	tuples "'N_DAI_OUT`_tuples_comp_str"'
63`}'
64`SectionWidget."'N_DAI_OUT`" {'
65`	index "'PIPELINE_ID`"'
66`	type "dai_in"'
67`	stream_name' STR($3)
68`	no_pm "true"'
69`	data ['
70`		"'N_DAI_OUT`_data_uuid"'
71`		"'N_DAI_OUT`_data_w"'
72`		"'N_DAI_OUT`_data_w_comp"'
73`		"'N_DAI_OUT`_data_str"'
74`		"'N_DAI_OUT`_data_comp_str"'
75`	]'
76`}')
77
78dnl W_DAI_IN(type, index, dai_link, format, periods_sink, periods_source, core)
79define(`W_DAI_IN',
80`SectionVendorTuples."'N_DAI_IN`_tuples_uuid" {'
81`	tokens "sof_comp_tokens"'
82`	tuples."uuid" {'
83`		SOF_TKN_COMP_UUID'		STR(dai_comp_uuid)
84`	}'
85`}'
86`SectionData."'N_DAI_IN`_data_uuid" {'
87`	tuples "'N_DAI_IN`_tuples_uuid"'
88`}'
89`SectionVendorTuples."'N_DAI_IN`_tuples_w_comp" {'
90`	tokens "sof_comp_tokens"'
91`	tuples."word" {'
92`		SOF_TKN_COMP_PERIOD_SINK_COUNT'		STR($5)
93`		SOF_TKN_COMP_PERIOD_SOURCE_COUNT'	STR($6)
94`		SOF_TKN_COMP_CORE_ID'			STR($7)
95`	}'
96`}'
97`SectionData."'N_DAI_IN`_data_w_comp" {'
98`	tuples "'N_DAI_IN`_tuples_w_comp"'
99`}'
100`SectionVendorTuples."'N_DAI_IN`_tuples_w" {'
101`	tokens "sof_dai_tokens"'
102`	tuples."word" {'
103`		SOF_TKN_DAI_INDEX'	$2
104`		SOF_TKN_DAI_DIRECTION'	"1"
105`	}'
106`}'
107`SectionData."'N_DAI_IN`_data_w" {'
108`	tuples "'N_DAI_IN`_tuples_w"'
109`}'
110`SectionVendorTuples."'N_DAI_IN`_tuples_str" {'
111`	tokens "sof_dai_tokens"'
112`	tuples."string" {'
113`		SOF_TKN_DAI_TYPE'	$1
114`	}'
115`}'
116`SectionData."'N_DAI_IN`_data_str" {'
117`	tuples "'N_DAI_IN`_tuples_str"'
118`}'
119`SectionVendorTuples."'N_DAI_IN`_tuples_comp_str" {'
120`	tokens "sof_comp_tokens"'
121`	tuples."string" {'
122`		SOF_TKN_COMP_FORMAT'	STR($4)
123`	}'
124`}'
125`SectionData."'N_DAI_IN`_data_comp_str" {'
126`	tuples "'N_DAI_IN`_tuples_comp_str"'
127`}'
128`SectionWidget."'N_DAI_IN`" {'
129`	index "'PIPELINE_ID`"'
130`	type "dai_out"'
131`	stream_name' STR($3)
132`	no_pm "true"'
133`	data ['
134`		"'N_DAI_IN`_data_uuid"'
135`		"'N_DAI_IN`_data_w"'
136`		"'N_DAI_IN`_data_w_comp"'
137`		"'N_DAI_IN`_data_str"'
138`		"'N_DAI_IN`_data_comp_str"'
139`	]'
140`}')
141
142dnl D_DAI(id, playback, capture, data))
143define(`D_DAI', `SectionDAI."'N_DAI`" {'
144`	index "'PIPELINE_ID`"'
145`	id "'$1`"'
146`	playback "'$2`"'
147`	capture "'$3`"'
148`}')
149
150dnl DAI Config)
151define(`N_DAI_CONFIG', `DAICONFIG.'$1)
152dnl DAI_CONFIG(type, idx, link_id, name, sai_config/esai_config/ssp_config/dmic_config)
153define(`DO_DAI_CONFIG',
154`SectionHWConfig."'$1$2`" {'
155`'
156`	id		"'$3`"'
157`'
158`	ifelse($1, `SSP', $5, $1, `HDA', $5, $1, `ALH', $5, $1, `ESAI', $5, $1, `SAI', $5, `}')'
159`ifelse($1, `DMIC', $5, `')'
160`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_tuples_common" {'
161`	tokens "sof_dai_tokens"'
162`	tuples."string" {'
163`		SOF_TKN_DAI_TYPE'		STR($1)
164`	}'
165`	tuples."word" {'
166`		SOF_TKN_DAI_INDEX'		STR($2)
167`	}'
168`}'
169`SectionData."'N_DAI_CONFIG($1$2)`_data_common" {'
170`	tuples "'N_DAI_CONFIG($1$2)`_tuples_common"'
171`}'
172`'
173`SectionBE."'$4`" {'
174`	id "'$3`"'
175`	index "0"'
176`	default_hw_conf_id	"'$3`"'
177`'
178`	hw_configs ['
179`		"'$1$2`"'
180`	]'
181`	data ['
182`		"'N_DAI_CONFIG($1$2)`_data"'
183`		"'N_DAI_CONFIG($1$2)`_data_common"'
184`ifelse($1, `DMIC',`		"'N_DAI_CONFIG($1$2)`_pdm_data"', `')'
185`	]'
186`}'
187`DEBUG_DAI_CONFIG($1, $3)'
188)
189
190dnl DAI_CONFIG(type, idx, link_id, name, ssp_config/dmic_config)
191define(`DAI_CONFIG',
192`ifelse(`$#', `5', `DO_DAI_CONFIG($1, $2, $3, $4, $5)', `$#', `4', `DO_DAI_CONFIG($1, $2, $3, $4)', `fatal_error(`Invalid parameters ($#) to DAI_CONFIG')')'
193)
194
195define(`HW_CONFIG_NAMES',
196`	hw_configs ['
197`	$1'
198`	]')
199
200define(`DAI_DATA_NAMES',
201`	data ['
202`	$1'
203`		"N_DAI_CONFIG_data_common"')
204
205dnl DO_MULTI_DAI_CONFIG(type, idx, link_id, name, sai_config/esai_config/ssp_config/dmic_config)
206define(`DO_MULTI_DAI_CONFIG',
207`$5'
208`SectionVendorTuples."N_DAI_CONFIG_tuples_common" {'
209`	tokens "sof_dai_tokens"'
210`	tuples."string" {'
211`		SOF_TKN_DAI_TYPE'		STR($1)
212`	}'
213`	tuples."word" {'
214`		SOF_TKN_DAI_INDEX'		STR($2)
215`	}'
216`}'
217`SectionData."N_DAI_CONFIG_data_common" {'
218`	tuples "N_DAI_CONFIG_tuples_common"'
219`}'
220`'
221`SectionBE."'$4`" {'
222`	id "'$3`"'
223`	index "0"'
224`	default_hw_conf_id	"'$3`"'
225`'
226`	$6'
227`	$7'
228`ifelse($1, `DMIC',`		"'N_DAI_CONFIG($1$2)`_pdm_data"', `')'
229`	]'
230`}'
231`DEBUG_DAI_CONFIG($1, $3)'
232)
233
234dnl MULTI_DAI_CONFIG(type, idx, link_id, name, ssp_config/dmic_config times n)
235 define(`MULTI_DAI_CONFIG',
236`ifelse(`eval($# < 5)', `1', `fatal_error(`Invalid parameters ($#) to MULTI_DAI_CONFIG')', `DO_MULTI_DAI_CONFIG($@)')'
237)
238
239dnl DAI_ADD(pipeline,
240dnl     pipe id, dai type, dai_index, dai_be,
241dnl     buffer, periods, format,
242dnl     period , priority, core, time_domain,
243dnl     channels, rate, dynamic_pipe)
244define(`DAI_ADD',
245`undefine(`PIPELINE_ID')'
246`undefine(`DAI_TYPE')'
247`undefine(`DAI_INDEX')'
248`undefine(`DAI_BE')'
249`undefine(`DAI_BUF')'
250`undefine(`DAI_PERIODS')'
251`undefine(`DAI_FORMAT')'
252`undefine(`SCHEDULE_PERIOD')'
253`undefine(`SCHEDULE_PRIORITY')'
254`undefine(`SCHEDULE_CORE')'
255`undefine(`SCHEDULE_TIME_DOMAIN')'
256`undefine(`DAI_CHANNELS')'
257`undefine(`DAI_RATE')'
258`undefine(`DYNAMIC_PIPE')'
259`define(`PIPELINE_ID', $2)'
260`define(`DAI_TYPE', STR($3))'
261`define(`DAI_INDEX', STR($4))'
262`define(`DAI_BE', $5)'
263`define(`DAI_BUF', $6)'
264`define(`DAI_NAME', $3$4)'
265`define(`DAI_PERIODS', $7)'
266`define(`DAI_FORMAT', $8)'
267`define(`SCHEDULE_PERIOD', $9)'
268`define(`SCHEDULE_PRIORITY', $10)'
269`define(`SCHEDULE_CORE', $11)'
270`define(`SCHEDULE_TIME_DOMAIN', $12)'
271`define(`DAI_CHANNELS', $13)'
272`define(`DAI_RATE', $14)'
273`define(`DYNAMIC_PIPE', $15)'
274`include($1)'
275`DEBUG_DAI($3, $4)'
276)
277
278# DAI_ADD_SCHED can be used for adding a DAI with sched_comp
279dnl DAI_ADD_SCHED(pipeline,
280dnl     pipe id, dai type, dai_index, dai_be,
281dnl     buffer, periods, format,
282dnl     period , priority, core, time_domain, sched_comp)
283define(`DAI_ADD_SCHED',
284`undefine(`SCHED_COMP')'
285`define(`SCHED_COMP', $13)'
286`DAI_ADD($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)'
287)
288divert(0)dnl
289