The SOF ALSA plugin allows SOF topologies to be run on the host. The plugin
is still WIP with many rough edges that need refined before production
deployment, however the plugin is usable today as a rapid development
framework for SOF infrastructure and processing.
Features that are function in the current implementation
* aplay & arecord usage working today
* modules are loaded as SO shared libraries.
* topology is parsed by the plugin and pipelines associated with the requested PCM ID are loaded
* pipelines run as individual userspace threads
* pipelines can be pinned to efficency cores
* pipelines can use realtime priority.
* alsa sink and alsa source modules available.
* pipelines can block (non blocking and mmap todo)
* 16-bit playback and capture support. Other formats to be added soon
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Update the struct tplg_comp_info to add some new fields needed for
parsing module information for IPC4. Also, introduce a couple of new
structures to save the pipeline info and fix the path to the peak_volum
header.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add the posix headers for use with the SOF ALSA plugin.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Parse the PCM headers and save the PCM info along with the host
component associated with the PCM.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add an option to parse and save the routes from topology so that the
IPCs can be sent at a later time.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Extend the definitions for struct tplg_context and struct tplg_comp_info
to include the fields to parse the ipc_payload and audio format
information from topology.
Also, add the logic for parsing the input/output audio formats from the
topology.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
These headers include alsa/sound/asoc.h and some versions of the
headers have this conditional include of types.h:
#if defined(__linux__)
#include <linux/types.h>
#endif
To ensure types __le64, __le32, __le16, __u8 are defined explicitly
include types.h becore including asoc.h.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch avoids the build errors. Most of the issues are
from different types for formatted printing in gcc vs. xt-xcc.
The "__attribute__ ((fallthrough));" is not supported in xt-xcc.
The xtensa C library does not have clock_gettime() so it is
only left out from build. The cycles count and MCPS is printed
instead.
The include of dlfcn.h is not needed since the testbench no
more has dynamic libraries.
Structs within structs need to be initialized to zero in xt-xcc
with multiple brackets.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Abstract the topology APIs to provide support for other IPC ABIs and
further simplify the codebase. Makse sure all public APIs have the tplg
prefix and make sure private APIs are in the correct places.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This patch adds simplified linux/types.h into testbench headers
to enable include of ALSA asoc.h to build without other difficult
kernel headers content.
The CMakeLists.txt files are updated to make a build time copy of
asoc.h to subdirectory include of the build directories. The new
directory is added to headers path.
This change avoids build fail with xcc toolchain that can't use the
gcc toolchain headers from the system where the ALSA headers are
located.
Suggested-by: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Pointer arithmetic with void pointer is not allowed. Functions
get_token_uint32_t() and get_token_comp_format() are updated
to handle correctly the bytes offset.
Functions get_token_dai_type() and get_token_process_type() are
updated to similar pointer arithmetic style as previous.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The xt-xcc compiler RG-2017.8 does not support -Wimplicit-fallthrough
option. Add to CMakeLists.txt files check for the option and use it if
it is supported.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Reduce complexity by parsing all topology objects in memory rather than
by seeking file, reading into allocated memory and then freeing memory.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
No functional runtime change, but changes to rtos partitioning and the
layout of headers .
This patch creates RTOS specifc header paths and updates spinlock.h
and kernel.h to show the new usage. Other headers will incrementally follow.
It reuses the current zephyr topleve directory and creates a new
toplevel xtos directory for xtos specific files.
Due to the mixing of RTOS, driver and library headers at the top level include
directory it was necessary to create rtos specific header directories i.e.
src/include/rtos-xtos
src/include/rtos-zephyr
These RTOS include directories will eventually contain RTOS specific headers
whilst common logic and structures will be placed in non RTOS directories.
This will also mean
"#include <sof/spinlock.h>"
will become
"#include <rtos/spinlock.h>"
and will allow easier visualisation of where and why RTOS headers are being used.
This will help to eliminate cross usage of headers between RTOSes.
Subsequqnt patches will move more headers and rtos specific wrppaer
source files into rtos specific locations.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This is another tplg_parser and testbench update on the road to provide
further flexibility around supporting new modules and IPC versions.
There will more to follow.
Changes are mostly mechanical code movements i.e. moving testbench related code
to the testbench, splitting the files into per module/component files and
making some functions static and public.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add support for loading the process components by UUID. This needs a
modification in the IPC3 helper to modify the ipc data pointer to
address followed by the UUID in the component extended data.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
In preparation for comverting the volume component to use the module
interface, add support for parsing the UUID from topology when parsing
the PGA widget in testbench.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
No functional change.
Move some common testbench code into the topology parser and group
feature parsing by file name.
Add a tplg_ prefix to external APIs without a prefix, others with an
existing prefix to follow this change.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The testbench currently has a global structure that contains
per topology and per pipeline data. Refactor to move data to the
most appropriate structure for use.
This is not the final fix, further refactoring is needed.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This is the first step in running a full DSP topology on multiple testbench
"virtual" cores. Testbench will use threads to virtualise a emulate a core
allowing topologies with more than one core to run simultaneously.
This patch makes the following changes.
1) Adds and passes a topology testbench context to all APIs instead of
relying on some globals.
2) Splits the testbench up into small functions that have a single purpose.
3) Creates a thread for each pipeline which in turn share a virtual core.
4) Adds the command line options to enable testing different cores and
pipelines.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Without CMP0079 we cannot conditionally include libraries against SOF in
sub directories without seriously restructuring the project. This is
because the old policy requires the link target must be created in the
same folder. This does not work well from a configuration standpoint for
3P audio libraries trying to keep their config in src/audio/*. Rather
than enable the policy, lets simply upgrade since 3.13 is widely
available.
With this upgrade we can also remove the two version dependent checks at
the top of our scripts.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Several files had multiple blank lines even before the removal of
platform_shared_commit(). Fix them with "cat -s"
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
We need clang support for the testbench therefore the following changes
are needed
remove -ftree-vectorizer-verbose since its deprecated in gcc and not
supported in clang
remove =3 from -Wimplicit-fallthrough=3 since 3 is the default level
anyways
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
free() system call frees the memory space pointed to by
ptr, which must have been returned by previous call to
malloc(), calloc() or realloc().
Now, when incrementing the array pointer, we may have
exceeded the actual allocated size. If we do pointer arithmetic
and subtract size from the array pointer, we may not point to
the actual location returned by malloc().
This patch makes sure that when we do pointer arithmetic on array,
the array's value at the end would be same as the one returned
by malloc.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
This patch uses the functionality added by the c9e090ccf3 commit
to check for array size mismatch in various components.
Not doing so may result in cases, where we try to write into the
space not allocated leading to segmentation fault.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
This patch uses the functionality added by the c9e090c commit
to check for array size mismatch while loading topology
buffer.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
This patch uses the functionality added by the c9e090ccf3 commit
to check for array size mismatch in components.
Since, the components are in places other than tplg_parser, the
function which checks for the mismatch has been made an external
function from a static one. The function declaration has been
added to the tplg_parser header files, so that the function can
be used by any code which needs array size checks in components.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
There may be a situation where size of all elements of the
snd_tplg_vendor_array is greater than the private data size.
If we take a look at array structure
struct snd_soc_tplg_vendor_array {
__le32 size; /* size in bytes of the array, including all elements */
__le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
__le32 num_elems; /* number of elements in array */
union {
struct snd_soc_tplg_vendor_uuid_elem uuid[0];
struct snd_soc_tplg_vendor_value_elem value[0];
struct snd_soc_tplg_vendor_string_elem string[0];
};
} __attribute__((packed));
and assume of private data size is size.
If num_elems * sizeof(..._elem) > size occurs, this is bad
because, we first try to allocate _size_ bytes via malloc to array
pointer. Since the num_elems * sizeof(..._elem) is greater than
size, we get a segmentation fault when we try to memcpy the
remaining size in the subsequent functions (read tplg_read_array()).
We fix this problem by checking for whether array size falls
within the bounds of private data size.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
In order to run multi-output component playback by testbench, this patch
supports multiple output file mode on running testbench. Argument "-o" is
modified to accept specifying up to 4 filenames delimited by comma,
e.g. "-o output1,output2,..."
Moreover, debug messages in tplg_parser/tplg_parser.c is refined for
demonstrating multiple pipelines better.
Signed-off-by: Pin-chih Lin <johnylin@google.com>
Before accessing the contents of the parameter pointer of the
function, check if the pointer is NULL. Else, it may lead to
segmentation fault.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>