Add initial macros to simplify the construction of topology components and pipelines.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- topology/m4/build.m4 | 44 ++++++++++++++ topology/m4/local.m4 | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 topology/m4/build.m4 create mode 100644 topology/m4/local.m4
diff --git a/topology/m4/build.m4 b/topology/m4/build.m4 new file mode 100644 index 0000000..0c40e4e --- /dev/null +++ b/topology/m4/build.m4 @@ -0,0 +1,44 @@ +#"PIPELINE_PCM_ADD(pipeline, id, pcm, pcm_buf, int_buf, frames, deadline) +define(`PIPELINE_PCM_ADD', +`undefine(`PCM_ID')' +`undefine(`PIPELINE_ID')' +`undefine(`BUF_PCM_SIZE')' +`undefine(`BUF_INT_SIZE')' +`undefine(`SCHEDULE_FRAMES')' +`undefine(`SCHEDULE_DEADLINE')' +`define(`PCM_ID', $3)' +`define(`PIPELINE_ID', $2)' +`define(`BUF_PCM_SIZE', STR($4))' +`define(`BUF_INT_SIZE', STR($5))' +`define(`SCHEDULE_FRAMES', STR($6))' +`define(`SCHEDULE_DEADLINE', STR($7))' +`include($1)' +) + +#PIPELINE_ADD(pipeline, id), int_buf, frames, deadline) +define(`PIPELINE_ADD', +`undefine(`PIPELINE_ID')' +`undefine(`BUF_INT_SIZE')' +`undefine(`SCHEDULE_FRAMES')' +`undefine(`SCHEDULE_DEADLINE')' +`define(`PIPELINE_ID', $2)' +`define(`BUF_INT_SIZE', STR($3))' +`define(`SCHEDULE_FRAMES', STR($4))' +`define(`SCHEDULE_DEADLINE', STR($5))' +`include($1)' +) + +#DAI_ADD(pipeline, dai_name, stream_name, win, wout)) +define(`DAI_ADD', +`undefine(`PIPELINE_ID')' +`undefine(`DAI_NAME')' +`undefine(`DAI_SNAME')' +`undefine(`IN_BUF')' +`undefine(`OUT_BUF')' +`define(`PIPELINE_ID', 0)' +`define(`DAI_NAME', $2)' +`define(`DAI_SNAME', $3)' +`define(`IN_BUF', $4)' +`define(`OUT_BUF', $5)' +`include($1)' +) diff --git a/topology/m4/local.m4 b/topology/m4/local.m4 new file mode 100644 index 0000000..2408830 --- /dev/null +++ b/topology/m4/local.m4 @@ -0,0 +1,159 @@ +define(`concat',`$1$2') + +define(`STR', `"'$1`"') + +#create direct DAPM/pipeline link between 2 widgets) +define(`dapm', `"$1, , $2"') + +#SRC name) +define(`N_SRC', `SRC'PIPELINE_ID`.'$1) + +#W_SRC(name, data)) +define(`W_SRC', `SectionWidget."'N_SRC($1)`" {' +` index "'PIPELINE_ID`"' +` type "src"' +` no_pm "true"' +` data [' +` "'$2`"' +` ]' +`}') + +#Buffer name) +define(`N_BUFFER', `BUF'PIPELINE_ID`.'$1) + +#W_BUFFER(name, size)) +define(`W_BUFFER', +`SectionVendorTuples."'N_BUFFER($1)`_tuples" {' +` tokens "sof_buffer_tokens"' +` tuples."word" {' +` SOF_TKN_BUF_SIZE' $2 +` }' +`}' +`SectionData."'N_BUFFER($1)`_data" {' +` tuples "'N_BUFFER($1)`_tuples"' +`}' +`SectionWidget."'N_BUFFER($1)`" {' +` index "'PIPELINE_ID`"' +` type "buffer"' +` no_pm "true"' +` data [' +` "'N_BUFFER($1)`_data"' +` ]' +`}') + +#PCM name) +define(`N_PCM', `PCM'PCM_ID) + +#W_PCM_PLAYBACK(stream)) +define(`W_PCM_PLAYBACK', `SectionWidget."'N_PCM`" {' +` index "'PIPELINE_ID`"' +` type "aif_out"' +` no_pm "true"' +` stream_name "'$1`"' +`}') + + +#W_PCM_CAPTURE(stream)) +define(`W_PCM_CAPTURE', `SectionWidget."'N_PCM`" {' +` index "'PIPELINE_ID`"' +` type "aif_out"' +` no_pm "true"' +` stream_name "'$1`"' +`}') + +#PGA name) +define(`N_PGA', `PGA'PIPELINE_ID`.'$1) + +#W_PGA(name)) +define(`W_PGA', `SectionWidget."'N_PGA($1)`" {' +` index "'PIPELINE_ID`"' +` type "pga"' +` no_pm "true"' +`}') + +#Mixer Name) +define(`N_MIXER', `MIXER'PIPELINE_ID`.'$1) + +#Pipe Buffer name in pipeline (pipeline, buffer) +define(`NPIPELINE_MIXER', `MIXER'$1`.'$2) + +#W_MIXER(name)) +define(`W_MIXER', `SectionWidget."'N_MIXER($1)`" {' +` index "'PIPELINE_ID`"' +` type "mixer"' +` no_pm "true"' +`}') + + +#Tone name) +define(`N_TONE', `TONE'PIPELINE_ID`.'$1) + +#W_TONE(name)) +define(`W_TONE', `SectionWidget."'N_TONE($1)`" {' +` index "'PIPELINE_ID`"' +` type "siggen"' +` no_pm "true"' +`}') + +#DAI name) +define(`N_DAI', DAI_NAME) +define(`N_DAI_OUT', DAI_NAME`.OUT') +define(`N_DAI_IN', DAI_NAME`.IN') + +#W_DAI_OUT(stream, data)) +define(`W_DAI_OUT', `SectionWidget."'N_DAI_OUT`" {' +` index "'PIPELINE_ID`"' +` type "dai_out"' +` no_pm "true"' +` stream_name "'$1`"' +` data [' +` "'$2`"' +` ]' +`}') + +#W_DAI_IN(stream, data)) +define(`W_DAI_IN', `SectionWidget."'N_DAI_IN`" {' +` index "'PIPELINE_ID`"' +` type "dai_in"' +` no_pm "true"' +` stream_name "'$1`"' +` data [' +` "'$2`"' +` ]' +`}') + +#Pipe Buffer name in pipeline (pipeline, buffer) +define(`NPIPELINE_BUFFER', `BUF'$1`.'$2) + +#Pipeline name) +define(`N_PIPELINE', `PIPELINE.'PIPELINE_ID) + +#W_PIPELINE(stream, deadline, platform)) +define(`W_PIPELINE', +`SectionVendorTuples."'N_PIPELINE`_tuples" {' +` tokens "sof_sched_tokens"' +` tuples."word" {' +` SOF_TKN_SCHED_DEADLINE' $2 +` }' +`}' +`SectionData."'N_PIPELINE`_data" {' +` tuples "'N_PIPELINE`_tuples"' +`}' +`SectionWidget."'N_PIPELINE`" {' +` index "'PIPELINE_ID`"' +` type "scheduler"' +` no_pm "true"' +` stream_name "'$1`"' +` data [' +` "'N_PIPELINE`_data"' +` "'$3`"' +` ]' +`}') + +#D_DAI(id, playback, capture, data)) +define(`D_DAI', `SectionDAI."'N_DAI`" {' +` index "'PIPELINE_ID`"' +` id "'$1`"' +` playback "'$2`"' +` capture "'$3`"' +`}')