Commit graph

7 commits

Author SHA1 Message Date
Carlo Caione 0ace886359 cache: Add note about buffer alignment and size
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>
2023-06-22 06:06:32 -04:00
Stephanos Ioannidis 8103b86796 drivers: cache: Fix circular dependency between cache API header files
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>
2023-04-25 23:17:27 +09:00
Carlo Caione a031ecdc9d cache: Fix the doxygen documentation
And create a new group.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-13 16:31:42 +00:00
Carlo Caione 189cd1f4a2 cache: Rework cache API
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>
2022-12-01 13:40:56 -05:00
Carlo Caione ae82071ae4 arch: Rework cache-related Kconfig symbols
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>
2022-08-18 11:30:49 +00:00
Yuval Peress c35012e122 include: Update references to <cache.h>
Use prefix zephyr/ for cache.h includes.

Issue #41543

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-21 07:40:54 -05:00
Yuval Peress 53ef68d459 include: Prefix includes to use a scope
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>
2022-04-08 19:03:32 +02:00
Renamed from include/drivers/cache.h (Browse further)