samples: ipc: openamp_rsc_table: conditional virtio ID sent on IPM device

Some IPM devices return an error if we request to transfer data.
Use IPM_MAX_DATA_SIZE to determine if the virtio ID can be transferred
through the IPM device.
Send data to IPM only if CONFIG_IPM_MAX_DATA_SIZE is not zero.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
This commit is contained in:
Arnaud Pouliquen 2025-04-25 15:28:22 +02:00 committed by Benjamin Cabé
commit 46cf96a04a

View file

@ -31,6 +31,13 @@ LOG_MODULE_REGISTER(openamp_rsc_table);
#error "Sample requires definition of shared memory for rpmsg"
#endif
#if CONFIG_IPM_MAX_DATA_SIZE > 0
#define IPM_SEND(dev, w, id, d, s) ipm_send(dev, w, id, d, s)
#else
#define IPM_SEND(dev, w, id, d, s) ipm_send(dev, w, id, NULL, 0)
#endif
/* Constants derived from device tree */
#define SHM_NODE DT_CHOSEN(zephyr_ipc_shm)
#define SHM_START_ADDR DT_REG_ADDR(SHM_NODE)
@ -133,7 +140,7 @@ int mailbox_notify(void *priv, uint32_t id)
ARG_UNUSED(priv);
LOG_DBG("%s: msg received", __func__);
ipm_send(ipm_handle, 0, id, &id, 4);
IPM_SEND(ipm_handle, 0, id, &id, 4);
return 0;
}