Commit Graph

201 Commits

Author SHA1 Message Date
Marcin Rajwa 53d35e4912 ut: add missing source file to build of KPB
This patch adds missing spinlock.c file to the build of
KPB component.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-02-17 20:25:38 +01:00
Bartosz Kokoszko bdc95775af component: add generic comp_verify_params() function
Implements comp_verify_params() function, which can be used in order
to set and update some of sink (playback) or source (capture) buffer
parameters with pcm parameters. There is a possibility to specify
which of parameters won't be overwritten (e.g. SRC component should
not overwrite rate parameter, because it is able to change it).
Commit also adds macros to buffer.h, which can be used in order
to specify which parameter of source/sink buffer should not be
updated.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2020-02-17 16:21:57 +00:00
Karol Trzcinski f493e907a1 test: buffer: Replace memcpy to memcpy_s
Introduced change resolve checkpach issue related with edited lines
of code.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-23 22:04:42 +02:00
Marcin Rajwa 895b46771c kpb: refactor some of KPBs macros
This patch refactor KPBs macros:

KPB_SAMPLING_WIDTH to KPB_SAMPLES_PER_MS as this is
exactly what this macro stands for - the amount of
samples we take each milisecond.

KPB_NR_OF_CHANNELS to KPB_NUM_OF_CHANNELS as the later
is more meaningful

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-01-23 10:32:43 +00: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
Karol Trzcinski 9a091a1320 test: Use common_mocks in each unit test
Link common_mock to each test by default.
Removed duplicated mocks in component specific folders.
Keep old mocks where implementation differs from
implementation in common_moks.c

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:45:29 +00:00
Karol Trzcinski 816f8919db test: Implement common mocks
In unit tests there are a lot of mocks duplication for mocks related
with memory management and panic routine.
As long as implementation doesn't have any module specific routines
and may be reused, it should be mocked in common mock space.

Marked each mock as WEAK to make it possible to overwrite this
implementation in specific test.

To use assert_false in __panic function, added dependence of
universal_mock from cmock.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:45:29 +00:00
Karol Trzcinski b7c92f18e6 test: Rename universal_mocks.c to common_mocks.c
Old name was quite misleading, new one better describes file content

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-01-22 14:45:29 +00:00
Tomasz Lauda a3e01c805a test: don't use shared section and uncache for unit tests
SHARED_DATA macros doesn't put shared data into separate section
when unit tests are built and uncached memory region is not used.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-20 14:37:01 +00: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 5eea994a3a component: add comp drivers list to sof context
Adds component drivers list to sof context, so it can be
accessed globally. Also adds global getter.

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 e465bca588 spinlock: revert explicit allocation
This patch reverts explicit spinlock allocation in shared
memory. From now on we assume every spinlock is already part
of the shared memory. This helps us avoid unnecessary cache
evictions, when accessing spinlock's data. Also some of the
spinlock API functions require interrupt header, so they were
extracted in order to avoid circular dependency.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-16 21:58:10 +00:00
Tomasz Lauda 80972f1d78 cavs: add section for shared data
This patch adds dedicated section for shared data
on cAVS platforms. This section will be used to store
static data, which can be accessed by multiple cores.
Access to this data will go through uncached memory region.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-16 21:58:10 +00:00
Marcin Maka 114a718e8d perf: add simple performance timestamps macros
Performance ts macros use both the platform timer and cpu timer
in case the latter is not always-running-timer.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-01-16 13:28:58 +00:00
Tomasz Lauda 1065e12a63 memory: add memory map to sof context
Adds memory map to sof main context. Also implements
getter to easily retrieve it through one point of access.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-11 16:10:04 +00:00
Tomasz Lauda 3f53d59e7b memory: pass sof context to platform_init_memmap
Changes platform_init_memmap function's argument list to take
sof context. It will be needed to add memory map pointer into
sof context.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2020-01-11 16:10:04 +00:00
Tomasz Lauda 670246e2f8 timer: use platform_timer from sof context
Changes accesses across the code to use platform_timer saved
in sof context instead of using externed global variable.

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
Marcin Maka 53eaa8c884 kpb: disable pm-runtime of master dsp core for data draining
Lower power state must be disabled before host wakes up and
sends 'quit D0ix' to make sure the draining goes at full speed.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-12-20 18:55:53 +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
Janusz Jankowski 3d44dead6f Revert "kpb: refactor some of KPBs macros"
This reverts commit 0eabf51c9d.
2019-12-17 11:14:07 +01:00
Marcin Rajwa 0eabf51c9d kpb: refactor some of KPBs macros
This patch refactor KPBs macros:

KPB_SAMPLING_WIDTH to KPB_SAMPLES_PER_MS as this is
exactly what this macro stands for - the amount of
samples we take each milisecond.

KPB_NR_OF_CHANNELS to KPB_NUM_OF_CHANNELS as the later
is more meaningful

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-12-16 15:58:19 +00:00
ArturX Kloniecki a88543a92c notifier: Refactor notifier interface and inner workings.
This patch changes usage of notifier, passing control over callbacks
allocation, allows nested callbacks processing and prepares interface
for future extenting.
This also optimizes unnecessary cache writeback/invalidation when
evaluating callback on the same core it was dispatched.

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
Tomasz Lauda e0491ff778 dai: volume: make pcm conversion in dai component
Changes processing flow and moves pcm frame format conversion
from volume to dai component. This way we'll no longer need to
artificially add volume into the pipelines, where it's not really
needed but frame format change is e.g. KPD topology. Dai is the perfect
place for conversion, since it's format is pretty much predefined and
comes from topology. Rest of the pipeline is configured from the host.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-11-26 13:42:17 +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
Karol Trzcinski 59a7e2819f kconfig: volume: test only supported data format
Do not run unit tests on unsupported by configuration
data types. See CONFIG_FORMAT_* macro.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 33d11ad659 kconfig: volume: group functions by supported data type
It will be helpful during next step - conditional code
compilation depending on configuration

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 20dabd5f1e kconfig: selector: test only supported by configuration data format
Do not carry test on unsupported data format for a five firmware
version.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Karol Trzcinski 34be3cec87 kconfig: mux: test only supported data types
Do not include data type test when it is not supported by
some platform or firmware version.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-11-11 12:22:11 +00:00
Paul Olaru 5c7a49af38 sof: build: Disallow void pointer arithmetic
Add compiler flags so that void pointer arithmetic is not allowed.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-11-04 15:26:20 +01:00
Tomasz Lauda 8fa4b80213 component: do not set buffer sizes
Change flow of components to not resize sink buffers.
We should just check the size of the allocated buffers
and let the topology define the maximum sizes.
Components can easily work with non aligned buffer sizes.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda df6017f950 buffer: add and init id, pipeline_id and caps fields
Adds and initializes id, pipeline_id and caps fields in buffer struct.
This is the only data needed after buffer creation. It allows us to
remove the whole sof_ipc_buffer struct from the buffers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-24 10:17:03 +02:00
Tomasz Lauda 6b22503e54 ipc: check whether pipeline id is already taken
When new pipeline is created we need to also verify whether
given pipeline id is already taken.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-17 13:39:41 +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 66b0a0f0b8 memory: Add alignment option for allocation
Add alignment option for memory requests.
Fix alloc definitions for UT.
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 de7d4c95cf pipeline: allocate pipe_task only if needed
Changes implementation of pipe_task allocation and initialization
to happen in prepare call instead of during pipeline creations.
It might be that the pipeline will never be used.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-10-01 14:32:36 +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
Tomasz Lauda b80338c395 idc: move to cavs drivers
Moves idc implementation to cavs drivers instead of keeping
it in generic xtensa arch directory. IDC is specific for
SMP cAVS platforms.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-09-30 11:34:39 +02:00
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