ipc_service: open-amp: Add __ASSERTs on cache alignment

Add some asserts to warn the user about unaligned VDEV status area,
VRINGs and buffers.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2023-06-22 11:37:29 +02:00 committed by Fabio Baltieri
parent 9752cbe045
commit 1fcb929108

View file

@ -758,6 +758,15 @@ static int backend_init(const struct device *instance)
data->role = conf->role;
#if defined(CONFIG_CACHE_MANAGEMENT) && defined(CONFIG_DCACHE)
__ASSERT((VDEV_STATUS_SIZE % sys_cache_data_line_size_get()) == 0U,
"VDEV status area must be aligned to the cache line");
__ASSERT((VRING_ALIGNMENT % sys_cache_data_line_size_get()) == 0U,
"Static VRINGs must be aligned to the cache line");
__ASSERT((conf->buffer_size % sys_cache_data_line_size_get()) == 0U,
"Buffers must be aligned to the cache line ");
#endif
k_mutex_init(&data->rpmsg_inst.mtx);
atomic_set(&data->state, STATE_READY);