The memcpy_s() function is called from CPP code in IADK modules.
Declare it as extern "C" when header included in CPP code.
Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
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>
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>
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>
Zephyr removed support for header inclusion without the zephyr/ path.
Update SOF with correct paths.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
With Zephyr, SOF uses k_cycle_get_64() API in order to
count clock cycles.
Not all platforms have a 64bit counter (e.g i.MX dsp integration
only has xtensa timer which is limited to 32 bits).
So, instead of using k_cycle_get_64 introduce new API sof_cycle_get_64
which keeps the existing behavior for platforms which define
CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER, otherwise use k_uptime_ticks().
See comments from @andyross at
https://github.com/zephyrproject-rtos/zephyr/pull/48318
Suggested-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Replaced sof timer related functions with Zephyr alternative.
Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Zephyr commit 174cb7f9f183 switched 'atomic_t' from 'int' to
'long' and broke SOF compilation as shown below.
Recent SOF commit 970d7d61ec ("zephyr: update print messages for
64-bit atomics") switched all atomic_read() logs to "%ld" instead of
"%d" which fixed compilation with Zephyr after the switch but broke it
with Zephyr _before_ the switch.
This no-op (long) cast makes SOF compatible with Zephyr both before and
after the switch.
Note the sof-logger does not make any difference between %ld and %d and
does not care.
Sample failure:
src/lib/dma.c: In function 'dma_get': sof/src/include/sof/trace/trace.h:290
error: format '%d' expects argument of type 'int', but
argument 5 has type 'atomic_val_t' {aka 'long int'} [-Werror=format=]
290 | printk("%llu " format "\n", platform_timer_get(NULL), \
| ^~~~~~~
sof/src/lib/dma.c:119:2: note: in expansion of macro 'tr_info'
119 | tr_info(&dma_tr, "..., busy channels = %d", atomic_read(...))
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
As of July 2021 we support (too) many tracing options and this
duplication is unfortunately the only way I found to support them all
while giving the compiler the opportunity to optimize away as many
strings as possible.
Supported configurations:
- Systems with limited memory and zero space for full strings, must use
SOF dictionary only.
- Systems with enough space for all strings to be in memory.
- Anything in between
- Support to duplicate only important message to both the DMA and the
mailbox (the default)
- CONFIG_TRACEM: supports duplicating ALL messages to both the DMA and
the mailbox
- CONFIG_TRACEV: supports deleting verbose statements at compile time to
save space
- CONFIG_TRACE: support turning off all traces at compile-time
- SOF dict trace de-duplication a.k.a. "adaptive filtering"
- Dynamic log levels per component
- Redirection to Zephyr's shared memory tracing that requires full strings.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
As of July 2021 we support (too) many tracing options and this
duplication is unfortunately the only way I found to support them all
while giving the compiler the opportunity to optimize away as many
strings as possible.
Supported configurations:
- Systems with limited memory and zero space for full strings, must use
SOF dictionary only.
- Systems with enough space for all strings to be in memory.
- Anything in between
- Support to duplicate only important message to both the DMA and the
mailbox (the default)
- CONFIG_TRACEM: supports duplicating ALL messages to both the DMA and
the mailbox
- CONFIG_TRACEV: supports deleting verbose statements at compile time to
save space
- CONFIG_TRACE: support turning off all traces at compile-time
- SOF dict trace de-duplication a.k.a. "adaptive filtering"
- Dynamic log levels per component
- Redirection to Zephyr's shared memory tracing that requires full strings.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Direct access to mbox shared memory logging when DMA tracing is
either not initialized yet or disabled or found broken for any
reason.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Commit 8357dcf793 ("zephyr: trace: use zephyr utilities when enabled")
added Zephyr's sys/printk.h in order to fix:
warning: implicit declaration of function 'printk'.
Remove #ifdef __ZEPHYR__ macro since this is not needed, because
the whole file is for Zephyr only.
Fixes: 8357dcf793 ("zephyr: trace: use zephyr utilities when enabled")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Use the Zephyr sys/printk.h when Zephyr RTOS is used.
Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Remove a log-module declaration to eliminate unused static
variables until we return to using the LOH_* Zephyr API.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This patch finalises the wrapper to allow LL scheduling of
timer domain audio, EDF sccheduling of IPC, trace re-direction
and kconfig build support.
There are still many items that are WIP and have been marked with
TODO: comments.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>