ipc: icmsg capability to clear rx buffer headers

On system startup icmsg headers space must be cleared before
cores start handshake procedure. The simplest way to enforce
it is to clear memory by the core responsible by enabling
the remote core, before the remote core is enabled and before
the handshake is started.

This patch ensures that nRF53 APP core clears both TX and RX
memory for icmsg before it starts NET core.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
This commit is contained in:
Hubert Miś 2022-11-10 14:29:34 +01:00 committed by Carles Cufí
commit 4a79754dd5
4 changed files with 22 additions and 0 deletions

View file

@ -366,6 +366,7 @@ static int shared_memory_prepare(const struct device *arg)
backend_config < backend_configs + ARRAY_SIZE(backend_configs);
backend_config++) {
icmsg_clear_tx_memory(backend_config);
icmsg_clear_rx_memory(backend_config);
}
return 0;

View file

@ -255,6 +255,7 @@ static int shared_memory_prepare(const struct device *arg)
backend_config < backend_configs + ARRAY_SIZE(backend_configs);
backend_config++) {
icmsg_clear_tx_memory(backend_config);
icmsg_clear_rx_memory(backend_config);
}
return 0;

View file

@ -246,3 +246,11 @@ int icmsg_clear_tx_memory(const struct icmsg_config_t *conf)
return 0;
}
int icmsg_clear_rx_memory(const struct icmsg_config_t *conf)
{
/* Clear spsc_pbuf header and a part of the magic number. */
memset((void *)conf->rx_shm_addr, 0, sizeof(struct spsc_pbuf) + sizeof(int));
return 0;
}