diff --git a/tools/topology/m4/pcm.m4 b/tools/topology/m4/pcm.m4 index 2319f8c24..bf8edac3e 100644 --- a/tools/topology/m4/pcm.m4 +++ b/tools/topology/m4/pcm.m4 @@ -71,6 +71,7 @@ define(`PCM_CAPABILITIES', dnl PCM_PLAYBACK_ADD(name, pcm_id, playback) define(`PCM_PLAYBACK_ADD', +`ifelse(`$#', `3', `SectionPCM.STR($1) {' `' ` # used for binding to the PCM' @@ -84,10 +85,12 @@ define(`PCM_PLAYBACK_ADD', `' ` capabilities STR($3)' ` }' -`}') +`}', `fatal_error(`Invalid parameters ($#) to PCM_PLAYBACK_ADD')')' +) dnl PCM_CAPTURE_ADD(name, pcm_id, capture) define(`PCM_CAPTURE_ADD', +`ifelse(`$#', `3', `SectionPCM.STR($1) {' `' ` # used for binding to the PCM' @@ -101,10 +104,12 @@ define(`PCM_CAPTURE_ADD', `' ` capabilities STR($3)' ` }' -`}') +`}', `fatal_error(`Invalid parameters ($#) to PCM_CAPTURE_ADD')')' +) dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture) define(`PCM_DUPLEX_ADD', +`ifelse(`$#', `4', `SectionPCM.STR($1) {' `' ` # used for binding to the PCM' @@ -123,6 +128,7 @@ define(`PCM_DUPLEX_ADD', `' ` capabilities STR($3)' ` }' -`}') +`}', `fatal_error(`Invalid parameters ($#) to PCM_DUPLEX_ADD')')' +) divert(0)dnl diff --git a/tools/topology/m4/utils.m4 b/tools/topology/m4/utils.m4 index 87049c294..4957e9f8c 100644 --- a/tools/topology/m4/utils.m4 +++ b/tools/topology/m4/utils.m4 @@ -10,6 +10,9 @@ dnl Argument iterator. define(`argn', `ifelse(`$1', 1, ``$2'', `argn(decr(`$1'), shift(shift($@)))')') +define(`fatal_error', `errprint(`m4: '__file__: __line__`: fatal error: $* +')m4exit(1)') + dnl Defines a list of items from a variable number of params. dnl Use as last argument in a macro. dnl The first argument specifies the number of tabs to be added for formatting