Commit Graph

177 Commits

Author SHA1 Message Date
Guennadi Liakhovetski 10f6dd0d7b module-adapter: add a constant data pointer
module_config contains a .data pointer that is used both for initial
and run-time configuration. The initial configuration should be
const. We add a new .init_data pointer for it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-10-26 15:56:49 +01:00
Seppo Ingalsuo f24670b986 Tools: Testbench: Add MFCC component
This patch adds load of MFCC component to testbench.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-05 13:07:10 +01:00
Liam Girdwood e8733b4f4c header: rtos: use rtos specific version of clk.h
Code can now include <rtos/clk.h>. API is not yet wrapped to Zephyr.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Liam Girdwood 4843516ab8 header: rtos: use rtos specific version of alloc.h
Code can now include <rtos/alloc.h> and uses thinly wrapped Zephyr
native for most uses. Wrapping can be removed over time.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Liam Girdwood c3c94fc515 header: rtos: use rtos specific version of wait.h
Code can now include <rtos/wait.h> and uses native Zephyr 64
cycle API instead of SOF version.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-06 15:37:21 +01:00
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 1629a1f72c header: rtos: decouple headers into rtos specific directories.
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>
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 2865cc2bb2 testbench: cmake: parser does not use CONFIG_LIBRARY cmake variable
Not used by parser cmakefile so delete.

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
Ranjani Sridharan ebc222dab5 testbench: fix UUID declaration for file
Use DECLARE_SOF_RT_UUID and fix the uuid name in the comp_drv for the
file component.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-06-02 16:05:56 +01:00
Seppo Ingalsuo 1df8cf856a Tools: Testbench: Fix file component buffer resize
The file component buffer resize was incorrect. It caused some
SRC testbench tests to fail due to insufficient sink buffer
size. The resize of file component source/sink was in prepare().
This patch moves it to one step earlier to params(). Then the
components' check for buffers in prepare() will see the impact
and let them error if the size is not sufficient.

After this change the number of periods in the buffer (from topology)
is preserved in resize. If a test does not run, need to fix the
test topology.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-28 15:43:38 +01:00
Seppo Ingalsuo 3334bede2a Tools: Testbench: Add components to testbench load
This patch adds load possibility of mux, demux, and
google-rtc-audio-processing to testbench.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-26 22:18:49 +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
Kai Vehmanen e20384eb6a testbench: add option to override CPU core mapping
Add option to override how a core id, specified in SOF topology, is
mapped to host core. This allows to map a multithreaded pipeline
execution to specific range of host CPUs.

Implement the option via environment variable "SOF_HOST_CORE0", which is
understood by the CONFIG_LIBRARY implementation of ll-scheduler.

Document the usage to testbench help. mapping of DSP core ids specified
SOF_HOST_CORE

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-02-09 09:44:34 +00:00
Liam Girdwood 9ad987e7fd testbench: return error up the stack.
Dont exit() but return the error up the stack for proper handling.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-02-08 10:43:18 +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 ac12b4a748 testbench: print a meaningful error if scheduling comp is not found
Let the user know if the scheduling component is missing and handle it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-02-08 10:43:18 +00:00
Liam Girdwood 6f43299f3b testbench: take the global data off the stack.
Testbench prm is global data used by many thread. Take it off the stack.

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
Seppo Ingalsuo 291706325c Tools: Testbench: Clean up help text and add missing help items
This patch changes the help print function. The print look and details
are improved. Executable behavior with option -h is fixed. Previously
the help text was printed twice.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-04 11:02:25 +00:00
Liam Girdwood 42f70ecffe testbench: log any errors freeing components.
let the user know if we fail to free a buffer, component or pipeline.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-31 16:16:27 +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
Liam Girdwood 7ee22be700 testbench: file: Add support for stopping testbench on file size/copies
Allow the testbench to stop on a file size or number of file(pipeline)
copies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-31 16:16:27 +00:00
Liam Girdwood 0f245bf151 testbench: split pipeline logic up into actions.
Split pipeline functionality into smaller action to support more
complex use cases. Provide more useful logging.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-31 16:16:27 +00:00
Liam Girdwood 7d4fca9802 testbench: only enable EDF scheduler once.
EDF enabled twice with testbench. Fix it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-31 16:16:27 +00:00
Liam Girdwood 9ed4557460 testbench: don't enable system agent.
SA is not used with testbench so disable it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-31 16:16:27 +00:00
Liam Girdwood e4b04290d4 testbench: fix help formatting and indentation.
Easier to read now and comprehend.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-31 16:16:27 +00:00
Liam Girdwood 4af91f2c04 library: testbench: Add LL scheduler emulation
Add LL scheduler emulation for testbench pipelines. Each core is
implemented as a thread.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-31 16:16:27 +00:00
Seppo Ingalsuo d155401343 Tools: Testbench: Fix long line
The line with multiband_drc library was too long for
checkpatch.pl check.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Seppo Ingalsuo cd3795d694 Tools: Testbench: Add more errors handling code
This patch adds to defaults of switch statements error prints
and error values returns to properly error non-supported
things.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Seppo Ingalsuo 4869b09717 Tools: Testbench: Copy in file max dev->frames amount of frames
This patch limits file read from reading more than e.g. 48 frames
at time when scheduled every 1 ms for 48 kHz audio. It helps
the testbench to execute copy() operations similarly as in real
firmware and not process multiple periods of data in the same
pipeline copy. Some components contain internal limiting for data
processing amount but most do not.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Seppo Ingalsuo 594853d389 Tools: Testbench: Use in prepare() frame_fmt from stream
The file component new() sets function to s32. It's better to
initialize to default function that just errors if called.

The stream pointer is retrieved from buffer. There is no need to
apply twice list_first_item() function. The sample width is set
with get_sample_bytes(). The switch case for frame_fmt is changed
to use stream. It avoids an error to use 16 bit file write to
consume data from 32 bit buffer. This happens because ipc value is
from topology while stream format is from command line override. Only
the text file output becomes incorrect.

The comp_data struct contained unnecessary fields such as period_bytes,
frame_bytes, and frame_fmt.

The patch also contains some switch-case code cleanup for more compact
code and look.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +00:00
Seppo Ingalsuo b502424819 Tools: Testbench: Improve binary file read and write performance
This patch replaces the sample by sample fread() and fwrite()
operations with max length block reads and writes without
circular wrap. Both binary and text format read and write
functions are replaced with more compact versions.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:36:07 +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
Bartosz Kokoszko 15c9335962 scheduler: allow scheduler_free functions to disable only irqs
This commit:
- adds flags argument into scheduler_free function pointer in
  scheduler_ops struct;
- adds SOF_SCHEDULER_FREE_IRQ_ONLY flag, which indicates to disable
  only interrupts in scheduler_free() functions.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2021-11-08 13:25:44 +00:00
Seppo Ingalsuo f47b823cfe Tools: Testbench: File write DAI needs data structures of DAI
Previously the file component stored component data to device
private data similarly as processing components. However the
pipeline treats file as DAI. Without this patch the missing driver
and DAI operation get_init_delay_ms() causes a segfault in pipeline
parameters walk. It is sufficient for the walk to pass to have just
rzalloc() cleared pointers in driver structure.

The file component data is now placed into DAI private data.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-09-15 14:41:47 +01:00
Curtis Malainey a0acad3414 CMake: require version 3.13
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>
2021-09-10 17:19:29 +01:00
Guennadi Liakhovetski f5760a648d pipeline: trigger START from the task context
When the firmware receives a START or RELEASE IPC message, it
immediately triggers all involved components, which starts DMA.
Then it schedules the pipeline task, but since the scheduler can be
already running at that time, the task might be scheduled when DMA
data isn't available yet or has already overflowed. To fix this
change the control flow to also trigger all components from the task
during its first run. Actual data processing then begins with the
next period. Note, that this is currently only possible with
pipelines, using timer-based scheduling. Pipelines, using DMA
interrupts for scheduling are unaffected.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01:00
Guennadi Liakhovetski 1103860a8d pipeline: add two new trigger commands and a new state
We need to split the START trigger command into two commands because
some components have a long delay inside their START handling. This
patch introduces two new trigger commands: PRE_START and
PRE_RELEASE and a new state PRE_ACTIVE to prepare for that split.
For simmetry POST_STOP and POST_PAUSE are also added, however they
aren't used yet.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-08-31 21:14:37 +01: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 eb7add5135 testbench: add a option for specifying the number of copy() iterations
All the user to specify the number of copies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood b8d6760600 testbench: fix crash when file has no . extension
Testbench crashed when a in/out file has not . extension. Fix this.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood 305223a1f6 testbench: free components and pipeline after test results.
Move the comp free to after the results and free the pipeline.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood 777c0008c1 testbench: add more helpful output for options parsing.
Lets be more helpful to the user.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +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 60a6b1330e testbench: improve error messaging on file failures.
Tell the user the error.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:27 +01:00