Commit Graph

356 Commits

Author SHA1 Message Date
Bartosz Kokoszko d42c01956f buffer: add overwrite in circular wrap case
In case when we overwrite "old" data in buffer
(when buffer is full) we should align r_ptr
with w_ptr.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-09-24 12:44:16 +02:00
Tomasz Lauda 8c61213c37 schedule: support dynamic scheduler creation
Refactors schedule code in order to allow dynamic scheduler
creation. We don't want to add every new scheduler to the static
array of scheduler_ops and also we don't want to have every
scheduler created on every platform. Maybe some of the platforms
won't need some of the future scheduler types.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-11 16:24:00 +02:00
Tomasz Lauda 20acc16791 edf_schedule: implement the new version of EDF scheduler
This patch implements the new version of EDF scheduler.
This is the first basic implementation, which can be easily extended
in the future.

Previous implementation had two major flaws:
- Tasks could only be preempted based on the interrupt level on which
they have been scheduled, so it was limited based on the hardware.
- This led to the system not fully utilized, so we could never achieve
full EDF functionality.

The new implementation uses only one software interrupt and allows for
dynamic context switching between different tasks based on the deadline.
Also for some cases priority is taken into consideration e.g. for idle
and almost idle tasks, which don't have deadline at all and should be
executed only if the system is free. All other normal tasks should have
the same priority. Task chosen to be run is executed on passive level,
so automatically can be preempted by every interrupt. Every task has
its own private stack on which current context is saved and restored
if needed. Note that main firmware loop is task scheduled with
idle priority, so it will be executed only after every other task
is completed.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-06 15:51:02 +01:00
Tomasz Lauda d1ede217e8 test: alloc: remove tests which don't test anything
Removes two tests which don't really test anything
and are based on magic numbers. Changing memory map
can easily break them.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-06 15:51:02 +01:00
Jaska Uimonen ebf406d084 unit tests: fix cmocka test for pipeline connect
cmocka pipeline connect unit test is checking the successful
connection from frames count set in components. However the frames
are not set in pipeline complete if we set the frames from stream
parameters. So check now that the pipeline pointer has been set
and matches the pipeline in high level test function.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2019-08-15 14:29:22 +02:00
Tomasz Lauda 9a6616a89b spinlock: replace spin_lock_* with irq_local_*
Replaces spin_lock_* macros with irq_local_* macros
in many places. Most of the code doesn't need to keep
synchronization between cores. Setting critical section
by disabling local interrupts is enough. Spinlocks should
be used only in the places, where both cores have access.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-07 14:22:52 +02:00
Tomasz Lauda ec9d1cad94 schedule: make some functions static inline
Transforms some of the short functions to static inline.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 4100fa0ac3 schedule: make schedule functions return task state
Instead of returning next period, schedule functions should return
state of the executed task. Period of the tasks is set during
initialization and doesn't change dynamically, so it doesn't make
sense to return it. With the new added SOF_TASK_STATE_RESCHEDULE
we can easily decide if the task is completed or maybe need to
be run once again.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 99005e21bc schedule: extract flags to generic task data
Extracts flags to generic task data, so there is no need
for ll_schedule to keep them privately. Also changes the
way they are passed. From now on flags should be set only
during task initialization and not when starting scheduling.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 2d16db19de ll_schedule: keep task period in private data
Adds new period field to task private data to keep
period set during schedule. Tasks shouldn't change
their period dynamically and in fact there is no
such task.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Janusz Jankowski f837e57b6e test: mux calc_sample_s16le
Unit tests for calc_sample_s16le with up to 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski 1bf779eef7 test: mux calc_sample_s24le
Unit tests for calc_sample_s24le with up to 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski 21375d45a2 test: mux calc_sample_s32le
Unit tests for calc_sample_s32le with up to 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski cfa339fece test: mux_prepare
Unit tests for mux prepare with valid and invalid formats.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski b5654b851f test: demux_copy
Unit tests for demux copy with 1 source, 4 sinks and 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski a4dcabcfc6 test: mux_copy
Unit tests for mux copy with 4 sources, 1 sink and 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Marcin Rajwa 5e3b739043 kpb: disable sys_agent before draining
Draining task can take a long time depending
on various params. This patch disables system
agent which raises DSP PANIC in case firmware
is hanged. However draining task can look to
system agent in exactly the same manner thus
we disable it right before draining task and
reenable after draining is done.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa 0b279e06bc kpb: move history buffer allocation to prepare
This change moves history buffer allocation
from kpb_new() to kpb_prepare(). This is to
folow the calling convention with kernel.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa d180cd343f memory: set LPSRAM related defines to zero if LP not configured
This patch sets all LPSRAM related memory defines to
zero if CONFIG_LP_MEMORY_BANKS is not defined.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 19:29:59 +02:00
Bartosz Kokoszko f3d79e7398 component: add comp_set_sink_buffer() function
Component in comp_prepare() should change sink buffer
only when sink component is not connected to dma.
comp_set_sink_buffer() checks whether sink component
is not connected to dma and in that case it try to
resize sink buffer.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-07-27 13:30:18 +02:00
Tomasz Lauda 5449dc2a30 panic: keep interrupts disabled after panic
This patch fixes the issue, where we've reenabled
the interrupts for the DSP, which sometimes caused
immediate DSP exception and overwrite of our dump.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-27 12:55:41 +02:00
Tomasz Lauda 418ddec569 panic: move panic related functions to new panic.h
Moves panic related functions from arch/sof.h to newly created
arch/debug/panic.h. Also change definition of arch_dump_regs
function to take dump buffer from caller. It decreases the
number of included headers in arch/debug/panic.h.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-27 12:55:41 +02:00
Tomasz Lauda 14b23ba5d3 task: move task structure and defines to the right header
Moves task structure and defines to the sof/task.h,
where they should be from the beginning. sof/schedule.h is
just for scheduler related things.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-19 15:50:35 +02:00
Tomasz Lauda 54d4d01d64 sof: move c files to dedicated directories
Moves c files to dedicated directories.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-18 16:00:24 +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
Tomasz Lauda 1944052617 drivers: include: platform: cleanup includes
Cleanups includes in all drivers, include and
platform files. Unused headers has been removed
and needed has beed added.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-16 15:02:06 +02:00
Tomasz Lauda a990c611c4 sof: change approach to including arch headers
Further work, but now it's done for remaining arch headers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-15 13:29:29 +02:00
Tomasz Lauda 2eb5857c77 arch: xtensa: merge UP and SMP architectures
Merges xtensa UP and SMP architectures.
The amount of code which were duplicated by creating
SMP architecture as separate instance is too big
to maintain. I've decided to merge both architectures,
change explicit selection of SMP to be dependent on
configured number of cores (> 1) and add branching in
xtos based on currently used processor configuration.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-12 15:05:57 +02:00
Seppo Ingalsuo 34d0db94be Cmocka: Volume: Increase test coverage for S24_LE output format
This patch adds check for sample to not exceed S24_LE range that
could happen in int32_t type storage. The existing check for
abs(delta) > 1 does not cover such case if e.g. the reference
volume code would output e.g. INT24_MAX and the FW component
INT24_MAX + 1.

Similar check is added for every reference volume function that
outputs S24_LE format.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-07-09 15:15:15 +02:00
Janusz Jankowski 084e7d6e79 test: add realloc stubs
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-07-03 13:55:30 +02:00
Tomasz Lauda 25bbc9f5cd schedule: extract schedulers to separate directory
Extracts schedule related implementations to the separate
directory to make it easier to locate and implement new
schedulers in the future.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-24 17:24:59 +01:00
Marcin Rajwa afbb2a6f53 memcpy: fix bug in memcpy_s for cmocka
memcpy_s has wrong check condition for
overlapping sections. The copy from adjacent memory
bloks will result in dsp panic while it should be
allowed. This patch fixes the issue for cmocka
tests.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-18 23:16:21 +02:00
Adrian Bonislawski f1fe78367a memory: new memory layout for APL, ICL, CNL and SUE
This will optimize memory usage and introduces two significant optimizations:

> Separate the memory (heaps, stack) by cores so if we will turn off a specific core we can also turn off all memory of this core.
> Remove fixed defines and gaps, previously stack was at fixed position: end of memory and buffer heap was everything between stack and fw. Now everything will be packed at sof_fw memory segment and takes only this memory which is really needed, everything else we can turn off.

Changelog:
BSS section now includes heaps and stack
Removed many heap fixed position defines
Removed gap before fw text section
memmap init is using real linker positions for heaps
Temporary stack for boot_ldr placed in heap_hp_buffer (safe)
sof fw max_size and segment limited to memory configured by memory banks count

Using new macro to stack init per core
Stack is no longer a one big block for all cores (core_count*stack_size)
System_runtime_heap and system_heap are no longer a one big block for all cores

For suecreek memory it will also introduce similar changes previously introduced
in other platforms
(One shared memory block SOF_FW for SOF_TEXT, SOF_DATA and SOF_BSS sections
Moved fw_ready near to .rodata and .data)

Memory layout for every slave core aligned to hw memory bank:
--align to memory bank--
system_heap
system_runtime_heap
stack
--align to memory bank--
next slave core..

Similar layout applies to master core

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-06-11 13:49:37 +02:00
Marcin Rajwa fb111cdebe cmocka: update KPB tests for new dependencies
KPB source code started to use timer related features
therefore cmocka tests need to include these
dependencies.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-11 13:25:16 +02:00
Marcin Rajwa b33574ce65 cmocka: update kpb test case
KPB_MAX_BUFFER_SIZE has changed therefore cmocka test
which uses this macro needs to be changed accordingly.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-06-06 09:47:33 +01:00
Tomasz Lauda 4d22a98f6c idc: change waiting code to be ms based
Changes waiting code in arch_idc_send_msg to be
milliseconds based instead of DSP cycles based.
This aligns nicely with the rest of waiting functions.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-06-05 21:22:50 +01:00
Janusz Jankowski 5dd9aaccb4 cmake: xtensa: use absolute paths for tools
CMake has convention of changing relative paths to absolute
for CMAKE_* variables. It does it automatically f.e. CMAKE_C_COMPILER.
However for our tools like objcopy we have to do it manually.
It also helps with integration of CMake in some IDEs.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-05 11:38:23 +02:00
Janusz Jankowski c6064624f6 cmake: add spdx license identifier
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-02 16:38:17 +01: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 02ffbea1a1 test: kpb: add license
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-02 16:38:17 +01:00
Janusz Jankowski d59cedbe61 test: include: add license
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-06-02 16:38:17 +01:00
Janusz Jankowski e39ed5ebf4 include: split uapi headers into more directories
Some of interface headers are not needed by kernel,
but are needed by user-space applications, so we can split them
into multiple directories that indicate their purpose.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-05-31 20:10:45 +01:00
Daniel Bogdzia 17eba5b190 test: add rballoc tests
Rballoc tests check if the current heap is full
the succeeding one would be taken

Signed-off-by: Daniel Bogdzia <danielx.bogdzia@linux.intel.com>
2019-05-30 12:02:05 +02:00
Tomasz Lauda ca45bc8303 audio: put multifile components to directories
This patch moves multifile components to separate
directories. All component headers are also moved to
include/sof/audio.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-05-17 17:39:45 +02:00
Jakub Dabek 3020d4aba4 memory: changed memcpy_s error handling
Failing to copy will result in FW panic

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2019-05-11 09:08:31 +02:00
Keyon Jie 72360bd42f kpb: fix kpb reset issue to make the consequent iteration work
We need reset kpb->state to KPB_STATE_BUFFERING, and unregister notifier
in .reset() as we will register it again at next .prepare(), otherwise,
the consequent record won't work.

Add definition of notifier_unregister() into cmoka fix the link error to
avoid breaking UT at the same time.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2019-05-07 12:26:56 +02:00
Janusz Jankowski 3a65b78f5f host: replace CONFIG_HOST and CONFIG_LIB with CONFIG_LIBRARY
We don't need 3 symbols - they all are used in the same case.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-05-07 08:49:48 +02:00
Seppo Ingalsuo adf8d66caf Volume: Improve coverage of cmocka tests
To help catching overflows this patch exercises the volume
component test with larger absolute value test data, both
positive and negative numbers. A test generator is added for
S24_4LE format.

Since the reference float arithmetic sometimes calculates the
sample with less accuracy than fixed point firmware code the
error is asserted when delta of reference and firmware is larger
than one LSB. The float code is off by one sometimes with negative
samples. To not complicate the test code this simple relaxation is
proposed.

The table of test inputs is commented with numbers to help to quickly
find a failing test case function if such happens from printed output
from cmocka test run.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-04-29 09:57:16 -07:00
Keyon Jie cbf2be22ed component: refine state change for xrun handling
When trigger xrun arrives, we will reset the component state to be
READY, which means prepare will needed before we can recover.

Update state machine diagram and cmoka unit test cases also.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2019-04-24 22:38:26 +01:00
Marcin Rajwa 304336ba60 CMOCKA-KPB: test and verify internal buffering
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-04-19 17:52:45 +02:00
Marcin Rajwa e39d0729e7 CMOCKA-KPB: perform copy test and its verification
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-04-19 17:52:45 +02:00
Marcin Rajwa e6967498c1 CMOCKA-KPB: connect sink and source to KPB device
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-04-19 17:52:45 +02:00
Marcin Rajwa 827b240847 CMOCKA-KPB: fill source buffer with test data
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-04-19 17:52:45 +02:00
Marcin Rajwa fb8a650877 CMOCKA-KPB: create dummy source && sink buffers
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-04-19 17:52:45 +02:00
Marcin Rajwa 3ff3b61886 CMOCKA: removed old memory allocation in testcases of KPB
The KPB component has changed its buffering
algorithm therefore its test cases needs to
be changed accordingly.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-04-19 17:52:45 +02:00
Seppo Ingalsuo 50bd96ded4 Volume: Allow use of extended volume scale up to 42 dB
This patch alters the volume IPC and ramp to use sQ8.16 gain
values instead of previous Q2.16 kind of unsigned gain value.
The driver has never set the min/max volume values in volume
new() IPC so the macro values VOL_MAX (+42 dB) and VOL_MIN (mute)
are used instead as limits.

The overflow in generic C code with s16 format is fixed. The
comments about volume Q format are updated.

The optimimized xt-xcc version of volume is changed to use 64
bits for multiply result to avoid loss of LSB bits in left shift
after multiply. With 64 bit result there is no need to scale the
volume multiplier as it was done with use of 32 bit multiply
result.

The cmocka volume type is changed to signed integer to match
component type used in this patch. The xtensa AE integer types
are signed so better to avoid unsigned gain values. The volume
scale in reference volume does a small error and cannot handle
above 0 dB max so it is changed as well. The test levels are
changed to exercise gains above and below 0 dB.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-04-18 22:06:13 +02:00
Slawomir Blauciak 0b56f064c2 kpb: rename comp_data struct to avoid conflicts
The kpb's comp_data struct is located in a public header,
which will be used by different components.
As such, it would cause conflicting definitions.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2019-04-18 12:51:01 +01:00
Janusz Jankowski c93670853f test: pipeline: remove mock for removed scheduler function
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-04-09 10:47:26 +02:00
Janusz Jankowski adc6cbe1be test: component: add missing header
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-04-09 10:47:26 +02:00
Janusz Jankowski 426647343f test: selector: remove unused variables
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-04-09 10:47:26 +02:00
Janusz Jankowski 51ef2db3d2 test: fix kpb compilation with -Werror
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-04-09 10:47:26 +02:00
Janusz Jankowski cfc78646e6 test: fix mixer compilation with -Werror
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-04-09 10:47:26 +02:00
Seppo Ingalsuo 22ecaa41e1 Component: Add comp_get_copy_limits() function for copy() preparations
This patch adds into component.c/h an utility function and
a data structure to simplify audio component's copy() method code.

The do-nothing function pipeline_xrun() is added to avoid cmocka test
fail due to adding function comp_get_copy_limits().

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2019-04-02 09:53:29 +01:00
Tomasz Lauda c14554349f component: add check if optional comp_ops are available
Adds check if optional comp_ops are available.
This patch also adds assert for mandatory ops.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-04-01 14:54:43 +01:00
ArturX Kloniecki 25cd7795cc debugability: extend core dumps to provide AR registers.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-03-27 21:10:48 +00:00
Janusz Jankowski d33f8c99a1 test: rename CHECK to UNIT_TEST
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-03-25 14:11:47 +00:00
Jakub Dabek f8703cd32c memory: changed memcpy calls to memcpy_s in audio lib
Signed-off-by: Jakub Dabek <jakub.dabek@linux.intel.com>
2019-03-21 16:51:51 +00:00
Janusz Jankowski f9494d9ce5 cmocka: add stdint.h includes
As written in cmocka documentation,
these headers have to be included before cmocka.h:

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-03-20 11:37:04 +00:00
Janusz Jankowski 0cc895d609 cmake: cmocka: add toolchain file for xt
It's needed to make cmocka build correctly
for generic instead of unix system

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-03-20 11:37:04 +00:00
Janusz Jankowski 6f88295017 cmake: fix memory mock lds for windows
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-03-20 11:37:04 +00:00
Janusz Jankowski c47f3dbc03 cmake: fix unit tests for ninja
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-03-20 11:37:04 +00:00
Bartosz Kokoszko 648345065a scheduler: add new generic scheduler api
This commit:
1. Renames specific schedulers:
	- schedule (.c/.h) -> edf_schedule (.c/.h)
	- work (.c/.h) -> ll_schedule (.c/.h)
2. Implements new generic scheduler api based on generic
   struct with scheduler ops. Every specific
   scheduler exports struct with pointers to its
   specific functions.
3. Makes edf and ll using generic api (exports structure
   with pointers to its own specific functions)
4. Updates host and pipeline tests due to scheduler
   changes.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-03-19 14:37:15 +00:00
Jakub Dabek 935d13b891 memory: prework for memcpy calls change
Prepared host build and whole solution to use new memcpy_s
Fixed string.h dependencies

Signed-off-by: Jakub Dabek <jakub.dabek@linux.intel.com>
2019-03-14 10:05:47 +00:00
Lech Betlej 18673780c3 test: selector: add support for binary configuration data
Channel selector component supports configuration get/set using
COMP_CMD_GET_DATA & COMP_CMD_SET_DATA commands
of SOF_CTRL_CMD_BINARY type

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-03-11 18:25:11 +01:00
Marcin Rajwa c833f572d0 KPB: search for real time sink
This change allows host to keep real time
sink at any position - not forced to be the
very first sink. Pointer to the sink itself
has been added to component private data
therefore .copy takes slightly less resources.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-03-11 18:23:39 +01:00
Adrian Bonislawski c06a65a8d0 Memory: self registering ability for audio components
No more need to update global component.h and audio.c component init list

New macro DECLARE_COMPONENT
The component can "register itself" in the appropriate linker section

Example of usage:
DECLARE_COMPONENT(sys_comp_*_init);

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-03-11 15:43:01 +00:00
Tomasz Lauda c694c09824 buffer: add buffer callback
Adds buffer callbacks, which can be called
after produce or consume.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-03-06 14:58:38 +00:00
Tomasz Lauda ad646299af pipeline: change copy flow
Changes copy flow to unify it no matter what is
the source of scheduling. Capture pipelines will always
start from source component and go downstream to sink
component. Playback pipelines for the first time will
start from sink component and go upstream to source
component (preload run). Further playback pipeline
copies will first copy sink component and then go
upstream to source component.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-03-06 14:58:38 +00:00
Tomasz Lauda 6077b57e19 pipeline: add sink component
Adds sink component to pipeline. It will allow
for pipeline copy direction simplification.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-03-06 14:58:38 +00:00
Tomasz Lauda 9a6a38a609 mixer: add support for variable data copy
Adds support to mixer for variable
data size copy.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-03-06 14:20:39 +00:00
Bartosz Kokoszko 0b63fde14d memmap: init memmap in runtime for cavs platforms
This commit adds:
1. memmap struct initialization for cavs in run-time.
2. setting proper .caps for all cores for system runtime memory.
3. add generic defines for heaps.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-03-05 12:05:03 +00:00
Lech Betlej 9845c9d418 test: kpb component name fixed in a configuration file
kpb directory is now added to cmoka test afer CONFIG_COMP_KPB is set

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-03-04 13:20:57 +01:00
Tomasz Lauda 99ee4432d1 cmocka: add unit tests for channel selector
Adds unit tests for channel selector component.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
2019-03-01 18:36:12 +01:00
Bartosz Kokoszko eae1d3a31c mailbox: deduplication of mailbox headers for cavs
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-03-01 10:26:54 +01:00
Marcin Rajwa 53a63eac14 KPB: add cmocka test cases for real time copy and internal buffering
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-03-01 10:16:23 +01:00
Adrian Bonislawski f8bf720ec1 Kconfig: make Mixer component a config option
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-02-28 18:34:26 +01:00
Janusz Jankowski 5ccbab2659 tests: add panic symbols for alloc
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-02-19 16:52:10 +00:00
Janusz Jankowski c5d01530af tests: fix idc for smp
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-02-19 16:52:10 +00:00
Tomasz Lauda 71b4f1d8c1 volume: refactor volume to support variable processing sizes
Refactors generic and HiFi3 volume processing implementations
to support variable processing sizes. The volume_copy method
will also be refactored in the near future to take advantage
of this feature.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-02-14 17:15:20 +00:00
Tomasz Lauda 2a863143e8 component: refactor set state handling
Changes component set state handling. If component
already has the desired state, then the state propagation
will stop at that component. This allows for connecting
multiple source pipelines to one sink pipeline and
properly handling params and prepare calls.
Also removes unit tests, which don't make sense anymore.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-02-13 11:37:30 +00:00
Adrian Bonislawski 7cf738ef51 Kconfig: make volume and src components a config option
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2019-02-06 16:22:36 +00:00
Janusz Jankowski 6c70f1a929 cmake: tests: support prebuilt Cmocka
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-01-31 20:22:30 +00:00
Jakub Dabek d0323f4d17 test: reinstated rest of memmory tests
Signed-off-by: Jakub Dabek <jakub.dabek@linux.intel.com>
2019-01-30 10:46:43 +00:00
Janusz Jankowski 621e8702cc cmake: use cmocka tiny config
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-01-25 15:57:51 +00:00
Liam Girdwood 0cd5fb0629
Merge pull request #878 from jajanusz/update-cmocka-git
cmake: update cmocka git
2019-01-24 08:17:44 +00:00
Janusz Jankowski 97f3b70d65 cmake: update cmocka git
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-01-23 20:31:24 +01:00
Tomasz Lauda d918f1b3d0 pipeline: refactor whole pipeline component
Refactor the whole pipeline component:
- one method to handle both upstream and downstream walk
  across the pipeline graph,
- code deduplication,
- cuts pipeline implementation size by half.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-01-23 17:07:10 +00:00
Janusz Jankowski d91be6da67 buildsystem: remove autotools from sof
This commit doesn't touch tools buildsystem.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-01-22 15:35:35 +00:00
Janusz Jankowski a59e428b61 test: debugability: fix for full paths
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-01-22 15:35:35 +00:00
Janusz Jankowski 9a3dff5475 cmake: add CMakeLists for unit tests
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-01-22 15:35:35 +00:00
Jakub Dabek 592b0a30fb test: reinstated some of turned off tests
Signed-off-by: Jakub Dabek <jakub.dabek@linux.intel.com>
2019-01-15 11:32:50 +00:00
Janusz Jankowski d40cff319f test: disable xtensa-only tests for host
Disables following tests:
Debugability - not designed to be run on host at all
Volume - needs some tuning to not fail
Buffer - needs some fixes to not have segfault

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-12-20 08:38:26 +00:00
Janusz Jankowski da9ab07085 test: fix _zalloc ut
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-12-19 13:04:36 +00:00
Liam Girdwood 699321e679 cmocka: host: Make sure cmocka builds and runs for host test bench
Fix some build issues with cmocka for host test bench target so that
cmocka UTs can run native on host architecture. This makes it easy for
users to update UTs when APIs change as they dont need architecture
specific version of cmocka.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-12-19 10:20:35 +00:00
Liam Girdwood 6b3f266653 cmocka: update component cmd API to new convention.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2018-12-19 10:20:35 +00:00
Janusz Jankowski dc8aaf3894 test: fix mixer ut ipc
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-12-12 11:52:56 +01:00
Tomasz Lauda 2649ec78aa test: alloc: fix system heap alloc tests
Fixes system heap alloc tests, which crashed
due to wrong handling of memory freeing.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-11-30 10:07:32 +01:00
ArturX Kloniecki 6ba817bee6 UT: Fix unit tests after faulty PRs were merged.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2018-11-13 16:06:50 +01:00
Michal Jerzy Wierzbicki 87dad4adc5 preproc: META_COUNT_VARARGS_BEFORE_COMPILE: bugfix for tokens starting with parenthesis not being counted
; also introduced unit tests to check the issue

Signed-off-by: Michal Jerzy Wierzbicki <michalx.wierzbicki@linux.intel.com>
2018-11-06 02:38:16 +01:00
Liam Girdwood 33e4b99351
Merge pull request #455 from mwierzbix/debugability
debugability: macro metaprogramming refactor
2018-11-02 16:00:02 +00:00
Michal Jerzy Wierzbicki b284ac32b5 debugability: Macro Metaprogramming Refactor
Added macro functions to make repetitive, nearly identical functions more maintainable via metaprogramming. They generate code in pre-compile, conceptually similar to C++17 if-constexpr.  sof/trace, host/trace: rewrote _trace_event/d+ functions using preproc.h. test/cmocka/include/test_group_generator: rewrote macros to not conflict with new ones. Added unit tests to check whether more advanced and less obvious macros do in fact work.

Signed-off-by: Michal Jerzy Wierzbicki <michalx.wierzbicki@linux.intel.com>
2018-11-02 11:44:31 +01:00
Marcin Maka d08a1e22d1 test: ut: added more stubs for trace functions
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2018-10-18 16:29:40 +02:00
ArturX Kloniecki b0150764dc debugability: Restore error traces always using mbox.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2018-10-15 16:40:53 +02:00
Liam Girdwood 1024e946a4
Merge pull request #482 from tlauda/topic/idc-notify
notifier: support for multicore notifications
2018-10-14 20:26:14 +01:00
Tomasz Lauda d16addfe99 notifier: support for multicore notifications
Adds support for multicore notifications:
- IDC that needs to be sent to slave cores.
- Flag which tells notifier, which cores should be notified.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-10-11 18:13:07 +02:00
Slawomir Blauciak 246de4bd41 test: Partially fixed alloc unit tests
Unfortunately tests for buffer/runtime zones will remain broken,
might require some rework in the firmware code.
For this reason, they shall be temporarily disabled.

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-10-11 14:06:50 +02:00
Tomasz Lauda 0e92db32c1 ut: fix tests on xtensa-smp
Fixes UT on xtensa-smp architecture.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-10-01 16:24:22 +02:00
Tomasz Lauda 3d5958f78b ut: include missing headers
Includes missing headers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-09-27 11:39:09 +02:00
Janusz Jankowski ccc9296498 test: fix: add log memory section
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-09-24 15:39:37 +02:00
Janusz Jankowski ae8a2be46c test: pipeline: update mocks
added missing new symbols - schedule_task_cancel

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-09-19 11:28:52 +02:00
Jakub Dabek 4434ca77c2 test: pipeline_free
Added tests for pipeline free and underlining static functions.
Also refactored previously added tests to incorporate code reuse.

Signed-off-by: Jakub Dabek <jakub.dabek@linux.intel.com>
2018-09-07 11:08:48 +02:00
Michal Jerzy Wierzbicki 73fe559435 lib/strcheck: added unit tests for lib/memset, lib/memcpy.; lib/bzero: merged into lib/strcheck;. .gitignore: added ommission of test build files.
Signed-off-by: Michal Jerzy Wierzbicki <michalx.wierzbicki@linux.intel.com>
2018-09-04 12:20:48 +02:00
Liam Girdwood 968b0c7191
Merge pull request #200 from mwierzbix/unitTest-lib-rstrlen
test: lib/rstrlen: Added unit tests for lib/rstrlen.
2018-09-03 13:45:18 +01:00
Janusz Jankowski 8d5382162d test: cmocka: fix pipeline tests, disable alloc tests
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-08-30 13:01:25 +02:00
Liam Girdwood 9d3c0df7bf Merge remote-tracking branch 'gh/glk-003-drop-stable' into next-master2 2018-08-29 13:18:53 +01:00
Jakub Dabek bd8902de71 tests: pipeline_complete
Added tests for pipeline complete and subsequently to
pipeline connect upstream and connect downstream since
they are both statics.

Signed-off-by: Jakub Dabek <jakub.dabek@linux.intel.com>
2018-08-23 16:25:13 +02:00
Marcin Maka 43398d22db dma: fixed writebacks when operating via L1 on dma buffer in L2 mem
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2018-08-23 14:57:53 +01:00
Marcin Maka 7cdcf034d1 dma: fixed writebacks when operating via L1 on dma buffer in L2 mem
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2018-08-23 15:25:22 +02:00
Michal Jerzy Wierzbicki fc59979f5f test: lib/rstrlen: Added unit tests for lib/rstrlen.
Signed-off-by: Michal Jerzy Wierzbicki <michalx.wierzbicki@linux.intel.com>
2018-08-23 12:39:10 +02:00
Liam Girdwood dc6014f226 Merge remote-tracking branch 'gh/next' into gp20-alpha-drop-stable 2018-08-16 15:52:03 +01:00
Michal Jerzy Wierzbicki f393ae33d3 test: lib/bzero: Added unit tests for lib/bzero.
Signed-off-by: Michal Jerzy Wierzbicki <michalx.wierzbicki@linux.intel.com>
2018-08-08 13:53:34 +02:00
Jakub Dabek 8dfedb67ae test: added pipeline tests
Added tests for pipeline creation and initialization

Signed-off-by: Jakub Dabek <jakub.dabek@linux.intel.com>
2018-08-07 17:36:55 +02:00
Michal Jerzy Wierzbicki 69a7cf556a test: lib/rstrcmp: Added unit tests for lib/rstrcmp.
Signed-off-by: Michal Jerzy Wierzbicki <michalx.wierzbicki@linux.intel.com>
2018-08-07 12:33:28 +02:00
Slawomir Blauciak d67df161c5 test: unify ut names
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-07-26 15:26:36 +02:00
Slawomir Blauciak 97a16bbf4e test: update mixer ut
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-07-26 10:33:01 +02:00
Slawomir Blauciak 18c171b43d test: mixer unit tests
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-07-25 09:44:05 +02:00
Bartosz Kokoszko 9524b6900d test: component: change comp_set_state test cases
Update comp_set_state test cases due to refinement the component's
state machine in commit 5198517.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2018-07-20 10:49:39 +02:00
Bartosz Kokoszko 8d9f9a7267 test: component: change to use 1 assert per test
I've fixed multiple assert occurance in comp_set_state test functions.
Now single UT has only one assert. There is also a change of the name
of the test file due to name restrictions.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2018-07-18 09:47:57 +02:00
Liam Girdwood 20204a9cd7
Merge pull request #110 from jajanusz/ut-makefile-fix
configure: fix flags for unit tests
2018-07-16 19:46:22 +01:00
Liam Girdwood b9b49ae555
Merge pull request #109 from bkokoszx/test_component_set_state
Test component set state
2018-07-16 15:53:52 +01:00
Janusz Jankowski 8235d3d61a configure: fix flags for unit tests
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-07-16 14:16:26 +02:00
Tomasz Lauda 9fbd0a4822 test: fix volume cmocka tests
Fixes volume cmocka tests.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-07-16 14:11:06 +02:00
Bartosz Kokoszko 31599ad097 Added comp_set_state function UT's
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2018-07-16 13:50:35 +02:00
Janusz Jankowski de100b7d28 test: fix CFLAGS and LDFLAGS warnings
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-07-10 15:25:33 +02:00
Liam Girdwood fa48c42abf
Merge pull request #59 from slawblauciak/test_fixes
test: missing header
2018-07-05 19:52:37 +01:00
Slawomir Blauciak b7a9f0f73c test: missing header
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-07-05 15:50:20 +02:00
Slawomir Blauciak 06b8c0e51b test: missing header
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-07-05 15:46:35 +02:00
Slawomir Blauciak 5a10cd8be2 test: alloc tests
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-07-05 12:01:29 +02:00
Tomasz Lauda 01ebad7a1b arch: multicore xtos
Support for multiple cores executing the same code
with the new arch xtensa-smp:
- Updated xtos to the latest version (2017.8).
- Modified xtos to handle interrupts per core.
- Added interrupt structures and stacks per core.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-06-29 15:12:01 +02:00
Tomasz Lauda 2fa6b3ac62 test: volume tests
Tests for volume processing functions.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-06-23 10:46:54 +02:00
Slawomir Blauciak b84cb09f27 test: audio buffer unit tests
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-06-20 15:18:10 +02:00
Slawomir Blauciak 3936516cdd test: incorrect param for one of norm_int32 tests
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-06-20 15:18:10 +02:00
Tomasz Lauda 14ca1fa3d5 pm_runtime: add runtime power management initial implementation
This patch adds initial empty implementation of runtime power management.
It is based on linux kernel implementation and will be developed
in the future.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2018-06-20 15:18:09 +02:00
Slawomir Blauciak 5827f391f6 test: Math unit tests
Tests provided: ceil_divide, find_equal_int16, find_min_int16, find_max_abs_int32, norm_int32, sin_fixed

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2018-06-20 15:18:09 +02:00
Tomasz Lauda cd0044e686 test: unit tests for list.h
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-06-11 20:12:43 +01:00
Janusz Jankowski d6d9efb90c test: enable cmocka unit tests for SOF
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2018-06-11 20:11:32 +01:00