Skip to content

Commit 46cf96a

Browse files
arnopokartben
authored andcommitted
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>
1 parent c1a1334 commit 46cf96a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

samples/subsys/ipc/openamp_rsc_table/src/main_remote.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ LOG_MODULE_REGISTER(openamp_rsc_table);
3131
#error "Sample requires definition of shared memory for rpmsg"
3232
#endif
3333

34+
#if CONFIG_IPM_MAX_DATA_SIZE > 0
35+
36+
#define IPM_SEND(dev, w, id, d, s) ipm_send(dev, w, id, d, s)
37+
#else
38+
#define IPM_SEND(dev, w, id, d, s) ipm_send(dev, w, id, NULL, 0)
39+
#endif
40+
3441
/* Constants derived from device tree */
3542
#define SHM_NODE DT_CHOSEN(zephyr_ipc_shm)
3643
#define SHM_START_ADDR DT_REG_ADDR(SHM_NODE)
@@ -133,7 +140,7 @@ int mailbox_notify(void *priv, uint32_t id)
133140
ARG_UNUSED(priv);
134141

135142
LOG_DBG("%s: msg received", __func__);
136-
ipm_send(ipm_handle, 0, id, &id, 4);
143+
IPM_SEND(ipm_handle, 0, id, &id, 4);
137144

138145
return 0;
139146
}

0 commit comments

Comments
 (0)