Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: ipm: fix in nrfx multi instance enabling procedure #1

Open
wants to merge 2 commits into
base: add_ipm_set_enabled
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion drivers/ipm/ipm_nrfx_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ static void vipm_nrf_##_idx##_register_callback(const struct device *dev, \
\
static int vipm_nrf_##_idx##_set_enabled(const struct device *dev, int enable)\
{ \
if (!IS_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_RX)) { \
if (!(IS_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_RX) || \
IS_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_TX))) { \
LOG_ERR("IPM_" #_idx " is TX message channel"); \
return -EINVAL; \
} else if (enable) { \
Expand Down
12 changes: 12 additions & 0 deletions subsys/ipc/rpmsg_multi_instance/rpmsg_multi_instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,18 @@ int rpmsg_mi_ctx_init(struct rpmsg_mi_ctx *ctx, const struct rpmsg_mi_ctx_cfg *c
/* Register IPM callback. This cb executes when msg has come. */
ipm_register_callback(ctx->ipm_rx_handle, ipm_callback, ctx);

err = ipm_set_enabled(ctx->ipm_tx_handle, 1);
if (err != 0) {
LOG_ERR("Could not enable IPM interrupts and callbacks for TX");
return err;
}

err = ipm_set_enabled(ctx->ipm_rx_handle, 1);
if (err != 0) {
LOG_ERR("Could not enable IPM interrupts and callbacks for RX");
return err;
}

ctx->vq[RPMSG_VQ_0] = virtqueue_allocate(vring_size);
if (!ctx->vq[RPMSG_VQ_0]) {
LOG_ERR("virtqueue_allocate failed to alloc vq[RPMSG_VQ_0]");
Expand Down
13 changes: 13 additions & 0 deletions subsys/ipc/rpmsg_service/rpmsg_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,19 @@ int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev)
}

ipm_register_callback(ipm_rx_handle, ipm_callback, NULL);

err = ipm_set_enabled(ipm_tx_handle, 1);
if (err != 0) {
LOG_ERR("Could not enable IPM interrupts and callbacks for TX");
return err;
}

err = ipm_set_enabled(ipm_rx_handle, 1);
if (err != 0) {
LOG_ERR("Could not enable IPM interrupts and callbacks for RX");
return err;
}

#elif defined(CONFIG_RPMSG_SERVICE_SINGLE_IPM_SUPPORT)
ipm_handle = device_get_binding(CONFIG_RPMSG_SERVICE_IPM_NAME);

Expand Down