Cache operations that act on unaligned buffers (with respect to cache
line) or buffers that are not multiple of the cache line size are at
least dangerous with an high risk of data and memory corruption.
While we do not enforce a contract on the buffer characteristics between
users and APIs, we can at least add a note in the documentation
specifying an undefined behaviour when the passed buffer is unaligned or
wrongly sized.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
When `CONFIG_EXTERNAL_CACHE=y`, the `zephyr/cache.h` header file
includes `zephyr/drivers/cache.h`, which then includes `zephyr/cache.h`
again.
This commit fixes the above circular dependency by removing the
unneeded `zephyr/cache.h` inclusion from the `zephyr/drivers/cache.h`.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
The cache operations must be quick, optimized and possibly inlined. The
current API is clunky, functions are not inlined and passing parameters
around that are basically always known at compile time.
In this patch we rework the cache functions to allow us to get rid of
useless parameters and make inlining easier.
In particular this changeset is doing three things:
1. `CONFIG_HAS_ARCH_CACHE` is now `CONFIG_ARCH_CACHE` and
`CONFIG_HAS_EXTERNAL_CACHE` is now `CONFIG_EXTERNAL_CACHE`
2. The cache API has been reworked.
3. Comments are added.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
We have now:
- CPU_HAS_{D,I}CACHE: when the CPU has support for d-cache and i-cache
- {D,I}CACHE: to enable / disable d-cache and i-cache
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Move include paths and add new target_include_directories to support
backwards compatibility:
* /include -> /include/zephyr
example: <irq.h> -> <zephyr/irq.h>
Issue #41543
Signed-off-by: Yuval Peress <peress@google.com>