Commit Graph

39 Commits

Author SHA1 Message Date
Liam Girdwood c90055f2f5 header: rtos: use rtos specific version of string.h
No runtime semantic change. Use C library when RTOS uses
C library otherwise use own C library calls.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-31 12:01:07 +01:00
Liam Girdwood 7288d52ab6 testbench: cleanup the logging to use printf.
No point in doing a sprintf to a local buffer.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood d9f9340e1a tplg_parser: split out testbench logic and partition features per file.
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>
2022-08-29 14:11:29 +01:00
Liam Girdwood 03b4f30129 testbench: include stdlib.h
Newer GCC version complain about free() not being defined.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Seppo Ingalsuo 69c69d01a4 Tools: Testbench: Add capture direction and multi-pipeline run
This patch changes testbench to retrieve pipeline direction
from pipeline host direction. Earlier all pipelines were forced
to playback.

The topology parsing filters the parsed pipelines to command line
specified pipeline IDs. All the pipeline operations are done
looped to these pipelines to be able to simulate multiple simultaneous
pipelines.

The pipeline context struct remains single. So the simulation works
only for pipelines with identical PCM format and rate.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-26 22:18:49 +01:00
Liam Girdwood 0db4a82964 tplg parser: refactor and cleanup part 1
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>
2022-03-24 16:54:40 +00:00
Liam Girdwood 0cec50a976 testbench: further refactor of per pipeline data
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>
2022-02-08 10:43:18 +00:00
Liam Girdwood 480d1ad168 testbench: improve error messages in topology load
Give users more information when failures occur.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-02-08 10:43:18 +00:00
Liam Girdwood c3adfcecc7 testbench: add support for mixer
Add mixer support to the testbench

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-02-08 10:43:18 +00:00
Liam Girdwood 28761ec8ab testbench: add support for virtual cores as threads
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>
2022-01-31 16:16:27 +00:00
Seppo Ingalsuo 30012d1454 Tools: Testbench: Support for different in/out channels count and other
This patch adds to command line switch -n for output channels count.
Existing -c is for in channels, new -n is for out channels count. Out
channels count is same as input if -n is not present. Switch -q is
added to quiet the trace output if it is not needed.

The Matlab language test scripts for components are updated to use
the -t config.sh interface of comp_run.sh. It allows more flexible
control of input and output streams.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-24 11:23:21 +00:00
Seppo Ingalsuo 9faf7e4e44 Testbench: Fix for multiple controls parsing for process components
This patch prevents topology parse failure when there are multiple
controls, e.g. enum controls.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-07-14 15:59:24 +01:00
Liam Girdwood bc10ba8b76 testbench: squash some valgrind warnings.
Buffer and params not initialised to zero like the other IPC structures
used by testbench. Fix this.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
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 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
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 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 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
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
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
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 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 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
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
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
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
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
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 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 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
Ranjani Sridharan c8b39dc9d6 testbench: Support reuse of topology parser
The topology parser in testbench can be re-used for
the other applications like the fuzzer. In order to
accomplish this, this commit does the following:
1. Separate the topology parser into a separate project
(tplg_parser) which implements the callbacks for parsing
all the components in topology.
2. Add support for parsing new components such as host
pcm, dai and mixer
3. Include the topology parser as an external project
in the testbench.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-08-07 08:47:58 +02:00
Tomasz Lauda 4ee9e1159c sof: move headers to dedicated directories
Moves headers to dedicated directories in sof/include,
arch/include and platform/include. File tree was too flat,
so some of the files has been moved.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-18 16:00:24 +02:00
Janusz Jankowski ecd506e16d license: use spdx in .c, .h and .S files with BSD3
Use SPDX License identifier in files that already
contain BSD-3-Clause license.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-02 16:38:17 +01:00
Janusz Jankowski 62e894eb9d testbench: rename include folder
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-05-07 08:49:48 +02:00
Janusz Jankowski 91578f1a22 host: move testbench to tools
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-05-07 08:49:48 +02:00