Commit graph

8 commits

Author SHA1 Message Date
Ranjani Sridharan
d8e9466e59 topology: pre-process-class: function to get attribute type
Add a helper function to get attribute type from the
attribute definition and convert them to SND_CONFIG_TYPE_*
values. When no type if provided for an attribute, type
defaults to integer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
0b0c16d4a7 topology: pre-process-class: add funcion to get the name of the unique attribute in a class
Every class must have a unique attribute that will be used
to instantiate the object. The value provided for this
attribute must be unique within the same alsaconf node for
objects of the same class. Add a helper function to get the
name of the attribute that must have a unique value in the
object instance.

For example, when instantiating 2 buffer widgets within a pipeline,
they must be given unique instance attribute values as:
Object.Widget.buffer.0{} and Object.Widget.buffer.1{}.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
7bf31094e2 topology: pre-process-class: Add functions to check attribute constraints
Add helper functions to check if an attribute is
mandatory, immutable or unique in the class definition.
ex: for a host widget component, these are defined
as follows:

	attributes {
		#
		# host objects instantiated within the same alsaconf node must have unique
		# direction attribute
		#
		unique	"direction"
		mandatory [
			"type"
			"stream_name"
		]
		immutable [
			"uuid"
		]
	}

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
1422c09afd topology: pre-process-class: Add function to look up attribute definition in class
Add a helper function look up attribute definition in the
"DefineAttribute" config in the class definition.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
c832f48404 topology: pre-process-class: Add helper function to look up class definition
Add a helper function to look up the class definition for
an object. ex: for an object instance, Object.Widget.pga.0{}, the
function returns the config pointing to Class.Widget.pga{} in
the input conf.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
eb514c6bd7 topology: pre-processor: Add a helper function to concat strings
The pre-processor needs to concatinate strings separated
by '.' for building object names from constructor attribute
values and searching for configs with ID's containing strings
separate by '.'. Add a helper function to concat strings in
the specified input format.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
94eaca13ce topology: pre-processor: Add a couple of config helpers
Add a couple of helper functions for searching config by ID and
creating and adding configs to a parent config.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00
Ranjani Sridharan
d508b1682a topology: pre-processor: Add debug print helpers
Add a couple of helper functions to print debug messages
and the generated config.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00