Commit Graph

177 Commits

Author SHA1 Message Date
Liam Girdwood da67183a6b testbench: fix the component type for file writer.
Incorrectly set as filereader. Fix it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:27 +01:00
Liam Girdwood 74e0872f08 testebench: no need for parenthesis around case values.
Remove and use correct style.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:27 +01:00
Liam Girdwood 6c290043f7 ipc: abstraction: Add initial IPC4 support.
This patch adds the initial IPC4 messaging structures as used by existing
host middle ware. These are mapped onto existing pipeline APIs to support
creation of certain pipeline elements using IPC4.

This patch only upstream the interfaces, the IPC handler is to follow.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:03 +01:00
Liam Girdwood 45918aa19b dai: abstract the DAI hardware configuration
Currently the DAI HW configuration is tightly bound to the IPC major
version and IPC structures. Provide a mechanism whereby different
IPC data structures can be passed for DAI configuration.

This change does the following changes.

1) Pass a common ipc_config_dai structure to all dai config call. This
allows retention of common logic that uses this common data.

2) Provide a IPC specific private data pointer to the dai config that
can be interpreted by the DAI as custom data. Today this is the
existing IPC, but it could also support an NHLT binary register blob in
the future.

3) Splits ipc specific code out of src/audio/dai.c and into
src/ipc/ipc3-dai.c.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-05-20 14:01:34 +01:00
Liam Girdwood 80666b7cc7 ipc: component: abstract the component creation API
Make sure component creation is not tightly coupled to a particular IPC
version. This is mostly a mechanical change of structures being passed
to the comp creation APIs away from IPC specific to general structures.

Highlevel changes

1) Pass a common component data object and a component
specific data object during create().

2) Mark the component IPC derived data as "ipc_config" within the
component device to help developers track the data source origin.

3) Pass component specific data during creation so that componets
can allocate and copy to thier private data.

4) Comp_dev no longer has component specific data appended to it.
Instead we can store all in the comp private data (and hence use the
compiler to access it rather than by developer access methods).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-05-10 15:36:07 +01:00
Curtis Malainey 30719babb4 testbench: print error on failure to prepare
We are capturing the error, we should log it, thank cppcheck for the
find.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey 0f0dd1d7ab testbench: remove unused sets
looks like a bug to checkpatch.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Liam Girdwood 1931168185 pipeline: decouple IPC major from pipeline_new().
Decouple the IPC ABI major version from pipeline creation. This moves
struct sof_ipc_pipe_new from the pipeline and replaces it with it's
members (saving 8 bytes as no header is needed).

Add new feature specific pipeline APIs to configure pipeline at creation.

Additionally align testbench and UTs to API change.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-19 14:29:37 +01:00
Liam Girdwood 6678b4022f testbench: align IPC structures on 4 bytes.
IPC is aligned on at least 4 bytes, removes compiler warning about packed
data being aligned on 1 bytes.

In file included from /home/lrg/work/sof/sof/tools/testbench/file.c:23:
/home/lrg/work/sof/sof/tools/testbench/include/testbench/file.h:59:1: error: alignment 1 of ‘struct sof_ipc_comp_file’ is less than 4 [-Werror=packed-not-aligned]
   59 | } __attribute__((packed));
      | ^

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-14 10:51:13 +01:00
Liam Girdwood c80270e7e4 ipc: structures should all be aligned on 4 bytes
Give the compiler a chance to further optimise IPC data access since it's
all on a 4 byte alignment.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-13 15:32:26 +01:00
Liam Girdwood 517ad95d51 ipc: split ipc headers per function.
Split IPC APIs out by feature so that the IPC layer to help future
IPC infrastructure changes support more than one IPC ABI MAJOR version.

No code changes here, only code partitioning and Doxygen comments.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-12 19:30:11 +01:00
Liam Girdwood 0f2c9d1230 cleanup: remove double blanks lines.
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>
2021-04-12 16:58:51 +01:00
Marc Herbert 288e228c67 cmake: generate the complete .config at configuration time.
Add cmake -DINIT_CONFIG= option that can point at any initial file.

"make clean" does not delete .config any more.

Note reconfiguration does NOT causes recompilation because -imacros
hides the generated .h from CMake's dependency scan. This is not a
regression, that problems exists since -imacros was introduced. At least
it's now possible to "make clean" and rebuild without losing the .config
file.

Fix for #3617

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-03 22:33:53 +00:00
Marc Herbert 9dc763f782 testbench/cmake: don't hardcode the BUILD_COMMAND
ExternalProject() preserves the existing BUILD_COMMAND

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-01-18 16:11:46 +00:00
Pin-chih Lin 97e0d50f5f tools: testbench: Add Multiband DRC component test
Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-12-28 13:19:54 -08:00
Guennadi Liakhovetski fe66007d4d testbench: file.c calls free(), it must include stdlib.h
Add the missing stdlib.h include to file.c.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-11-21 16:22:54 +00:00
Marc Herbert 3de29dac2a testbench: make lib_table actually global and stop passing it around
This fixes compilation with:

  CFLAGS=-fno-common ./scripts/rebuild-testbench.sh

  sof/tools/testbench/topology.c:24: multiple definition of `lib_table';
  sof/tools/testbench/testbench.c:39: first defined here

This was detected by Gentoo 10 which uses -fno-common by default, thanks
Guennadi for the report and investigation.

Commit 03067c6c77 ("host: set up shared library table") introduced a
strange "lib_table" symbol that was apparently meant to be global but
was not really because of some confusion between arrays and pointers and
needed to be passed around and "initialized to itself" (!) at run time
as seen in the sample trace below:

topology.c

struct shared_lib_table *lib_table;

parse_topology(..., library_table,...)
{

        printf("DEBUG1 ----- %p, %p, %p\n",
                  &lib_table,     lib_table,      library_table);

        lib_table = library_table;

        printf("DEBUG2 ----- %p, %p, %p\n",
                 &lib_table,      lib_table,      library_table);

}

Log:

    DEBUG1 ----- 0x56298c954040, 0x56298c951183, 0x56298c954040

    DEBUG2 ----- 0x56298c954040, 0x56298c954040, 0x56298c954040

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-11-05 23:09:35 +00:00
Curtis Malainey c5a0cf0d27 host: move edf_schedule to platform
move to allow other programs to use the scheduler

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-20 09:28:28 +01:00
Curtis Malainey 9b9264d03b host: move sof_get to platform
Move out of testbench so whole system can use as needed

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-20 09:28:28 +01:00
Pin-chih Lin d32ec2caeb tools: testbench: Add DRC component test
Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-10-08 11:51:16 +01:00
Curtis Malainey f601906d83 host: move drivers and libs out of testbench
In order to support more linux based testing apps lets move the drivers
for the library build into the rest of the source tree so it is easy to
develop additional apps.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2020-10-06 11:04:38 +01:00
Curtis Malainey fd398c9d5e cmake: allow testbench to build with clang
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>
2020-09-28 10:37:26 +01:00
Guennadi Liakhovetski 047f08f20e uuid: use a pointer instead of casting it to an integer
UUID objects are represented by struct sof_uuid_entry instances in SOF.
Instead of casting pointers to them to integers for passing around,
carry them as pointers until they have to be cast to integers for
packing into data structures. This also fixes printing UUID, using a
"%pU" format.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-09-15 09:33:29 +01:00
Seppo Ingalsuo 46e49cc3b4 Tools: Testbench: Fix mistake in topology component load by UUID
The if test needs to be done for comp_type. The index does not refer
to comp types but items in lib_table that is not correct. As result
testbench loads crossover for all UUID based components. The load of
beamformer works correctly with this change.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-09-13 15:52:24 +01:00
Seppo Ingalsuo 1ad7503299 Tools: Testbench: Add TDFB component UUID information
This patch adds the needed information to testbench to load the
TDFB component.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-09-13 15:52:24 +01:00
Jaska Uimonen de514ca0ff tools: testbench: add crossover loading with uuid parsing
Add crossover library loading with new uuid method.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2020-09-07 12:04:28 +01:00
Jaska Uimonen a40bb45be8 tools: testbench: add uuid based library loading
Add methods to load process libraries based on uuid. Testbench will
first search the old process enums and if match isn't found the same
search is done with uuid. Hence old process components should get loaded
with enums and new uuid based components should get loaded with uuids if
the uuid definition is declared and added to the library table.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2020-09-07 12:04:28 +01:00
Seppo Ingalsuo 40fd801c29 Tools: Testbench: Add system agent initialization
This patch fixes a segfault with null sof->sa pointer in
pipeline_schedule_copy() function. The bug has not been observed
with test topologies for processing pipelines but with other
topologies with fuzzer varied parameters.

The sa_init() is added to tb_pipeline_setup(). The scheduler_init_edf()
is a dependency. The two dummy functions platform_timer_get() and
clock_ms_to_ticks() are also added as dependency. The CMakelist for
library is edited to include agent.c build for testbench.

Fixes #3247

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-08-27 11:59:04 +01:00
Mohana Datta Yelugoti c0b969d784 tools: testbench: initialize local variable before accessing it
If user fails to provide a topology file, the tplg_file member
of structure tp is left uninitialized. This member is used to
check again if the file was provided, which won't be possible
unless this has been initialized to NULL and checked for NULL
after parsing arguments.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-25 13:13:30 +01:00
Mohana Datta Yelugoti 96a474897a tools: testbench: check for array size mismatch for components
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>
2020-08-18 10:36:41 +01:00
Mohana Datta Yelugoti d9712ef671 testbench: topology:check array size mismatch in filewrite component
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>
2020-08-18 10:36:41 +01:00
Mohana Datta Yelugoti 108912bba8 tools: testbench:add null pointer variable check before accessing it
When the realloc() function fails, a NULL pointer is returned. But,
if the size argument is zero, then also NULL is returned. So, to
differentiate that, we also check if size is non zero. Only if
pointer is NULL and size is non-zero, we come to the conclusion that
realloc() failed and the allocated memory till now is freed and
appropriate error is returned.

If realloc is called on a pointer and fails, the memory pointed by
the pointer isn't freed. When realloc() fails, even this memory
is freed.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-10 11:10:20 +01:00
Pin-chih Lin b63c3a3723 tools: testbench: Support channels specification
Support channel specification by argument "-c" on testbench

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-08-06 12:25:14 +01:00
Pin-chih Lin d38d5892f6 tools: testbench: Support multiple output files
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>
2020-08-06 12:25:14 +01:00
Keyon Jie 639154e35b testbench: topology: initial the sof_ipc_comp_file with 0s
Initial the struct sof_ipc_comp_file to make sure all no updated flags
are 0s.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-08-05 14:53:31 +01:00
Mohana Datta Yelugoti d9fea08a24 tools: testbench: check if pointer is null before accessing it
Check if a pointer is NULL before accessing it, else, it leads
to segmentation fault.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Mohana Datta Yelugoti b1dec44124 tools: testbench: initialize pointer before freeing it
When we try to free a pointer which is not initialized, we are
using a value in the program which is undefined. So, initialize
the pointer variable, so that in future, when we free the pointer
it won't cause a problem.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Artur Kloniecki 238cd1457d treewide: Remove references to .free and .avail members of audio_stream.
All audio_stream clients should use provided audio_stream_get_avail*/free*
API, instead of directly accessing .avail and .free member fields.

Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
2020-08-03 21:53:14 +01:00
Mohana Datta Yelugoti 9f1106d8a5 testbench: add null pointer check for function argument
tb_pipeline_params() function takes an argument called ipc_pipe,
which is a pointer and is derefernced in the function to access
a member of structure that pointer is pointing to.

If this pointer is NULL, this leads to Segmentation fault. A
null pointer check is added before the argument is dereferenced.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-07-23 14:28:26 +01:00
Marc Herbert a3a9eb3a2b cmake: no space after -imacros to avoid de-duplication
This is not needed yet as we use only one -imacros at a time but could
save someone a lot of time in the future; including the author of this
patch who will have forgotten about it in a few weeks.

For more details see
https://github.com/zephyrproject-rtos/zephyr/commit/e53c0d0ec7640b
and links from there.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-24 11:29:27 +01:00
Marc Herbert 1002899b95 Use '-imacros config.h' instead of explicit #include <config.h>
Using -imacros on the compiler command line instead of explicitly
including config.h is not just less tedious in the future:
- it also makes sure configuration always comes first and is never
  accidentally missed by an earlier #include
- it makes sure all translation units get the (same) configuration
- it lets parent projects like Zephyr override the config.h name

To test this I ran ./scripts/xtensa-build-all.sh -a -r, compared
binaries before and after this change and found no output difference.

Full disclosure: this required a few unrelated tricks not submitted here
like a .tarball-version file, commenting out __DATE__ and __TIME__ in a
few places, running strip-determinism on the .a files because our
crosstool-ng reference is not cutting-edge, etc.

As Tigerlake is not built by default it required a couple more hacks to
compile.

Blank lines are left instead of the former #include lines so even debug
objects are the same.

Only defconfigs were tested. On the other hand, this commit was _not_
performed by a script but by changing the name of the generated file and
clicking on and fixing every build failure. This proves that every
removed #include was actually required by one or more tested defconfigs
and that the added -imacros flag does affect the compilation of all the
modified files.

There is no #include config.h left: they were all in use in at least
one _defconfig.

I think comparing all binaries produced by ./scripts/xtensa-build-all.sh
-r -a provides extensive enough coverage but note this was tested only
with the crosstool-ng toolchain described in the SOF documentation.

The obsolete[*] xt-xcc front-end is gcc-based and the newer xt-clang
front-end is (surprise) clang-based. clang (copies many gcc options and)
does support -imacros so I don't expect any issue with either xt-xcc or
xt-clang. In the worst case, I do not expect any compiler front end to
_silently_ discard any unknown command line flag nor to ignore a missing
or misnamed config.h file.

[*] https://github.com/zephyrproject-rtos/zephyr/issues/3165

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-22 13:01:26 +01:00
Bartosz Kokoszko a2d1e1efdc component: add set of helper functions for large config configuration
This commit rewrites functions responsible for large config configuration
from detect_test component and puts them in component.c file as
generic ones - as a result they can be used by other components.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-06-17 11:33:23 +02:00
Karol Trzcinski 27d4c943f3 testbench: Add UUID for file component
Each component driver should have assigned UUID value and trace
contecxt, to allow generic component creation routine usage.
It's espiecially important for trace context, because it's
accessed by pointer so dereferencing NULL pointer will lead to
segmentation fault.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-04 15:42:52 +01:00
Adrian Bonislawski 8f0e4d858b cmake: testbench compile options fix
This will provide CONFIG_LIBRARY variable for testbench build

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-05-18 13:25:28 +01:00
Adrian Bonislawski 863eb0a072 cmake: merge BUILD_LIBRARY and CONFIG_LIBRARY
There is only one valid CONFIG_LIBRARY which can be
configured via kconfig

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2020-05-18 13:25:28 +01:00
Seppo Ingalsuo 578d698e5e Testbench: Return -errno values from malloc and fseek functions
This patch replaces the manually set error codes with errno that
is set to exact fail reason like ENOMEM etc. by these functions. The
missing return code checks for fseek() calls are added.

Include of header errno.h is added to topology.c. The order of
include statements is fixed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-05-07 17:33:07 +01:00
Marcin Maka 6ce635aa82 trace: replace TRACE_CLASS_ by uuids
All trace entries are identified by uuids only now.
Previous TRACE_CLASS_ identification removed completely.

UUIDs are passed to the tracing subsystem inside a trace
context. Each trace context defines run-time log level.
The level is initialized to LOG_LEVEL_INFO (this may be
change per instance is needed) and may be re-configured
at run-time.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-04-30 11:39:37 +02:00
Marcin Maka 245f5aa8a8 alloc: remove unused rrealloc
rrealloc function is no longer in use, so it is better
to remove it. Unused code is no longer tested so its
quality is unknown.

The current implementation is simple but expensive since
extra calls to malloc/free requires time and risky since
at some point requires double allocation of potentially
large object. Please consider re-implementation instead
of restoring.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-04-10 20:00:05 +03:00
Tomasz Lauda 1c2f3c0ce5 schedule: return status of operations
Changes schedule operations to return error in case
chosen scheduler is not found or scheduler doesn't
support mandatory operation.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-04-10 14:45:49 +02:00
Marcin Maka e306d1293e alloc: fix potential oob in rbrealloc
Previous memcpy of bytes is unsafe if new object is larger
then old one.

Typically realloc retrieves the old size internally and does
not need this information passed as argument but sof heap
implementation does not store the exact size of the allocated
memory buffer.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-04-08 10:51:37 +01:00
Marcin Maka 75b8c1e8f8 alloc: fix potential oob in rrealloc
Previous memcpy of bytes is unsafe if new object is larger
then old one (which is probably most popular realloc use).

Typically realloc retrieves the old size internally and does
not need this information passed as argument but sof heap
implementation does not store the exact size of the allocated
memory buffer.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-04-08 10:51:37 +01:00
Marcin Maka 5f24796630 comp: use comp_alloc in existing components
Replaces the common, required part of the initialization
copied by every implementation.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-04-07 13:51:04 +03:00
Marcin Maka 36e58d279b alloc: replace r- macros with renamed functions
Once the debug version of allocation functions are removed,
macros may be replaced with functions declared without leading
_ which makes the documentation (and the header) more readable,
the defines section does not need to contain doubled documentation
of alloc api.

bzero macro is not esasily removable due to include deps which
bring earlier declaration of non-inline prototype.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-27 10:43:23 +01:00
Seppo Ingalsuo 8320376ab4 Testbench: Fix segfault in pipeline_new() in topology parsing
This patch fixes the crash by adding initialize of sof->pipeline_posn
into pipeline initialization code.

Also the in load_pipeline() function the pipeline is initialized
to zeros to prevent random values to be passed in not set
struct fields. It didn't fix anything but makes debugging of crash
easier.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-03-27 10:40:37 +01:00
Marc Herbert ba38c7d750 Testbench: panic() calls abort()
... as opposed to doing nothing and returning.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-03-27 10:26:56 +01:00
Sebastiano Carlucci 60fc730003 tools: testbench: Include dcblock in testbench
This commit adds support for running test for dc blocker.

Signed-off-by: Sebastiano Carlucci <scarlucci@google.com>
2020-03-26 16:49:37 +00:00
Marcin Maka 0f88be3e1a mm: separate alloc api and heap mgmt api
All clients that just wants to allocate and free memory
does not need to know all the heap management api
and internals.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-26 10:09:32 +00:00
Payal Kshirsagar 7a646c9dbd testbench: remove unneeded variable
Remove unneeded temporary local variable, its declaration and newlines.

Signed-off-by: Payal Kshirsagar <payalskshirsagar1234@gmail.com>
2020-03-25 15:22:09 +01:00
Marcin Maka 23d0eae9e2 comp: ops: rename new as create
New is c++ keyword which causes errors while generating
the documentation for component api with sphinx and breathe.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-25 11:04:15 +01:00
Seppo Ingalsuo dc44384ea0 Testbench: Fix possible uninitialized use of variable ret
This patch fixes the read_samples_32() function in file component.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-03-20 13:29:00 +00:00
Seppo Ingalsuo 0eeda80bdf Testbench: Add processing component load
This patch adds to testbench capability to run pipelines with EQ_IIR
and EQ_FIR components. The component is configured with the topology
embedded configuration blob when instantiated with new().

The load of volume component has been enhanced to parse volume tokens and
compute the min and max volume parameters.

The topology parsing and component library load has been changed to
support processing component load and extracting of control private
data. The testbench build has been changed to create libraries
for EQ components.

The testbench command line parsing has been improved to return
error for invalid library request.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-03-20 13:29:00 +00:00
Marcin Maka ac01040efe comp: api: advanced and internal functions separated
The current content of component.h is a mix of basic api, common
basic helpers for every component developers as well as advanced
functions and macros used by infrastructure and very specialized
components like host, dai, kpb etc.

This patch moves the advanced part to component_ext.h and keeps
only basic part in component.h to avoid overloading effects
component developers with declarations and code they do not use.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-17 16:13:29 +01:00
Marcin Maka 0529c141f4 tasks: add uuid based identification for tasks
Tasks activities may be traced and analysed easier if they
are identified by uuids and named.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-17 15:11:42 +02:00
Marcin Maka fcd0895b74 trace: remove legacy trace classes
TRACE_CLASS ids used by parts switch to uuid-based logging
marked as unused.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-06 10:15:04 +01:00
Tomasz Lauda 3609fa6fc6 ipc: use notifications allocated by sources
Changes implementation of notifications allocation.
Instead of using common empty list of messages let's
switch to allocating message per source of notification.
This way we won't have problem with memory and lack of
empty messages and also we will be able to optimize memory.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-03-02 13:28:52 +01:00
Karol Trzcinski 51a3234458 testbench: Fix build error
There was missing argument in file_get_hw_params, what breaks compilation.

Fixes: 2b84838 ("Testbench: Instantiate file component as host")
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-02-27 11:19:39 +02:00
Seppo Ingalsuo 0bce9e4f36 Testbench: Instantiate file component as host or DAI and other updates
This patch fixes the fail to execute tests due to recent pipeline
updates. Now the fileread and filewrite component is instantiated
as host or DAI depending on stream direction. The DAI file component
is added the capability to report HW stream parameters. In testbench
case the stream parameters originate from command line parameters.

The file params() handling is updated to be similar as in other
components to successfully propagate the parameters.

The added capture pipelines support is not fully functional and will
be fixed later.

The testbench cleanup includes elimination of global variables for
certain component ids. The needed misc parameters were added to
testbench parameters struct that is passed through most topology
parsing functions.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-02-26 22:29:10 +00:00
Marcin Maka 247af133b8 comp: init back ptr to driver early in new
Back pointer must be initialized before any instance
level logging is performed by the new() operation since
the instance identification requires access to the uuid
that will be implemented on the component driver level.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-02-19 20:51:58 +00:00
Marcin Maka 210f907ba2 comp: improve access to component properties
Static inline getters provides better control of use
component properties as L- and R-values.

They also make changes to the common component data defs
easier and transparent for clients (no code changes, just
recompilation required).

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-02-19 14:22:11 +00:00
Seppo Ingalsuo 274049c5a2 Testbench: Add packed attribute to file component IPC struct
This patch fixes build fail of testbench. The packed attribute
is added similarly as in IPC structs of other components. The
reported error with gcc 9.2.1 is:

sof/tools/testbench/file.c:408:11: error: converting a packed
‘struct sof_ipc_comp’ pointer (alignment 1) to a
‘struct sof_ipc_comp_file’ pointer (alignment 8) may result in
an unaligned pointer value [-Werror=address-of-packed-member]
408 | (struct sof_ipc_comp_file *)comp;

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-02-11 17:00:09 +00:00
Seppo Ingalsuo 5dcace1211 Testbench: Propagate fail from topology parse load widget
This patch avoids the testbench to crash when file read or write
file open was not successful. E.g. invoking testbench with
incorrect input file name caused a segfault.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-01-31 21:06:39 +00:00
Seppo Ingalsuo 24bbea3ef2 Testbench: Force scheduler to EDF
This patch adds force of scheduler type to EDF since it is the
only simplified scheduler version that is included to testbench.
The schedule_task_init_ll() stub is updated to call schedule_task_init()
to prevent a check for NULL run operation to fail. The patch also
changes the memory allocation to calloc() to clear the reserved data
to value NULL for similarity with rzalloc() in SOF.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-01-31 21:06:39 +00:00
Seppo Ingalsuo 5b89f29445 Testbench: Add pipeline trigger stop to test end
This patch adds the missing call to end of test run. It prevents
the pipeline reset to print error traces about illegal state
change.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-01-31 21:06:39 +00:00
Seppo Ingalsuo 71d9dbe62b Testbench: Force core to zero to be able run the pipeline
This patch sets in topology parsing core to zero for file reader,
file writer, and buffer since it was left uninitialized and caused
the core check in pipeline run to fail.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-01-31 21:06:39 +00:00
Seppo Ingalsuo 1f09719260 Testbench: Fix file component data read and write
This patch retrieves the channels count either from sink or
source. The previous code failed for file read since source
is NULL. A similar kind of mistake also caused the period_bytes
to be calculated as zero.

Finally as code simplification the calculation of bytes is moved
to variable declaration to avoid duplicated statement.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-01-31 21:06:39 +00:00
Seppo Ingalsuo 40f7cf7a28 Testbench: Initialize system notify
This patch adds the initialization to testbench start code. Without
it the notification from buffer consume/produce causes segfault.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-01-31 21:06:39 +00:00
Adrian Bonislawski 716bc4bdd8 probes: initial implementation, kconfig and IPC params
Probes are a feature that will allow user to extract and inject data
from/into buffers at runtime.

Basic flow is as follows:
1. Initialization of probes subsystem, allowing for simultaneous
   configuration of DMA for extraction. If extraction DMA is not setup
   during init, extraction probes will be disabled.
2. Configuration of probe points, preceded by DMA configuration in case
   of injection probes.
3. Probes are now in operation and will send single multiplexed stream from
   extraction probe points and inject data into specified buffers.
4. State of probes and associated DMAs may be retrieved via INFO functions.
5. Removal of probe points.
6. Removal of injection DMAs.
7. Deinitialization of probes subsystem.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2020-01-29 11:26:58 +01:00
Karol Trzcinski 9508d2efbd buffer: Create audio stream buffer
When new component will need to process audio data in two steps,
then temporary circular buffer will be needed. Also extra information
about data stream may be needed to choose right algorithm or assert data
compatibility.

Currently only 'comp_buffer' has such a possibility but it is component
defined in topology - with much wider capabilities - and shouldn't be
created inside component just to hold temporary data stream.

Use introduced structure in processing functions, move api responsible
for data processing from buffer to audio_stream module.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:56:22 +00:00
Janusz Jankowski 38c84de747 trace: add mn class
Add trace class for M/N divider.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2020-01-21 02:34:48 +01:00
Tomasz Lauda 7867944946 component: use comp_driver_info during registration
Changes component driver registration to use comp_driver_info
as an element to be put into the drivers list. This way
comp_driver can be constant and comp_driver_info can be
marked as shared in the future.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-20 14:37:01 +00:00
Tomasz Lauda 47917c1f3d component: pass sof context to sys_comp_init()
Passes sof context pointer to sys_comp_init() function.
It will be needed in order to add comp_driver_list to
sof context.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-20 14:37:01 +00:00
Tomasz Lauda 29de310834 ipc: merge ipc_shared_context
Removes shared_ctx from ipc structure and add its members
directly to struct ipc. From now on ipc struct needs to
be shared to support SMP. It's done in order to eliminate
possible wrong pointer to shared_ctx, since it was a part
of cached data.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-16 21:58:10 +00:00
Tomasz Lauda 6524cc89c1 sof: add getter for sof main context
Adds getter function for acquiring pointer to sof main context.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-11 16:10:04 +00:00
Tomasz Lauda 5f85648c5a alloc: create enum type for heap zones
Creates new mem_zone enum type for heap zones.
We don't want to leave them as flags and allow
zone combinations.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-23 21:11:48 +01:00
Tomasz Lauda bc246b5da8 alloc: remove zone argument from balloc functions
Removes zone argument from balloc related functions.
They always use RZONE_BUFFER, so passing something else
is very misleading, especially it changes nothing.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-23 21:11:48 +01:00
Tomasz Lauda 6a8a3d02f1 alloc: extract flags to separate argument
Extracts flags from zone to use them as a separate argument
during allocations. It allows for addition of new zones and
also is more clear this way.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-23 21:11:48 +01:00
Tomasz Lauda 8fe7b72682 edf_schedule: remove priority
Removes need to pass EDF task priority during initialization.
Also removes priority definitions, which were only used by
EDF scheduler. Priorities of EDF tasks are now deprecated.
We are scheduling based only on deadline.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-19 20:29:59 +00:00
Tomasz Lauda c42f9bd621 task: extract task ops to separate struct
Extracts task operations to separate struct. This way we can
add additional ops without need to endlessly adding parameters
to schedule_edf_task_init function.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-19 20:29:59 +00:00
Tomasz Lauda 2baeeadeda schedule: separate task init functions for schedulers
Separates task init functions for all currently supported schedulers.
Some of the parameters are not common, so there is no need to
artificially extend function signatures.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-12-19 20:29:59 +00:00
ArturX Kloniecki 81936774c8 notifier: Add traces for notifier.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-12-12 11:08:00 +01:00
Bartosz Kokoszko 74e1bcc786 component: move pcm params from component to buffer struct
Moving pcm params from component to buffer is the first
step to improve parameter propagation within pipelines. This commit
moves several pcm paremeters (framet_fmt, buffer_fmt, rate,
channels, chmap, except direction) to comp_buffer struct.
Some of specific parameters are moved to private host and
kpb data.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-11-29 10:58:33 +00:00
Seppo Ingalsuo c9bf3dc15a ASRC: Add ASRC into testbench
This patch adds the ASRC component and the new tokens into topology
parser and testbench component loader.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-11-27 09:49:48 +00:00
Slawomir Blauciak c7b914dd14 ipc: channel map structures and api
This change adds stream map and channel map structures
used for channel re-routing and stream aggregation.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2019-11-20 10:44:51 +00:00
Janusz Jankowski 1d92e8e175 sof: use RELATIVE_FILE instead of __FILE__
Use RELATIVE_FILE because __FILE__ makes binary output
dependent on project location.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-11-11 12:50:30 +00:00
Tomasz Lauda f724ef1058 edf_schedule: do not pass sof structure anymore
Changes scheduler_init_edf and task_main_init function
definitions as sof structure is no longer needed. It was
only used to pass agent object to main idle task.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 11:11:50 +02:00
Tomasz Lauda 99c16a69e3 ipc: rename ipc_get_comp function
Renames ipc_get_comp function to ipc_get_comp_by_id.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:41 +02:00
Jakub Dabek 0bc4e9fde9 host: Fix memory function definitions
Fix alloc definitions for host build.
Function definitions were using defines in their body
which blocked usage of const values in said defines.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-10-11 14:26:08 +02:00
Tomasz Lauda 3afc474518 task: add complete callback
Adds complete callback to task. Some EDF tasks will need to have
additional callback on task completion, which will be executed
in critical section along the setting task state to complete.
Doing it during regular execution is not enough, because it's done
on passive level and we want to avoid any race condition.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Tomasz Lauda eb0d309cf9 task: rename func to run
Renames task's func to run to better show intention of this callback.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 11:24:40 +02:00
Seppo Ingalsuo 81f8de93c5 Tools: Test: Updates for testbench to match other changes in SOF
This patch updates the locations of "make install" libraries default
install locations into shell script to run SRC test cases. The script
also now prints the used LD_LIBRARY path to ease setting up code
debugging.

The segfault of testbench executable is fixed by returning a valid
pointer reference instead of a NULL from test dummy function
arch_schedulers_get().  The rest of testbench version of schedule.c
was also updated to be like the current real version module.

Finally in the testbench.c main the file names string pointers are
initilizated to null as well as the word length parameter to avoid
a segfault if executable is started without command line arguments
to see the usage help text.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-09-18 20:50:50 +02:00