Skip to content

Commit

Permalink
Temporary workaround for PPR reset
Browse files Browse the repository at this point in the history
  • Loading branch information
doki-nordic committed Nov 28, 2024
1 parent 421d110 commit 313531d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions subsys/ipc/ipc_service/backends/ipc_icmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,16 @@ static int backend_init(const struct device *instance)
&backend_ops);

Check notice on line 104 in subsys/ipc/ipc_service/backends/ipc_icmsg.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/ipc/ipc_service/backends/ipc_icmsg.c:104 -#define DEFINE_BACKEND_DEVICE(i) \ - static const struct icmsg_config_t backend_config_##i = { \ - .mbox_tx = MBOX_DT_SPEC_INST_GET(i, tx), \ - .mbox_rx = MBOX_DT_SPEC_INST_GET(i, rx), \ - .unbound_mode = UNBOUND_MODE(i), \ - }; \ - \ - PBUF_DEFINE(tx_pb_##i, \ - DT_REG_ADDR(DT_INST_PHANDLE(i, tx_region)), \ - DT_REG_SIZE(DT_INST_PHANDLE(i, tx_region)), \ - DT_INST_PROP_OR(i, dcache_alignment, 0), \ - UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_DISABLE, \ - UNBOUND_MODE(i) == ICMSG_UNBOUND_MODE_DETECT); \ - PBUF_DEFINE(rx_pb_##i, \ - DT_REG_ADDR(DT_INST_PHANDLE(i, rx_region)), \ - DT_REG_SIZE(DT_INST_PHANDLE(i, rx_region)), \ - DT_INST_PROP_OR(i, dcache_alignment, 0), \ - UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_DISABLE, \ - UNBOUND_MODE(i) == ICMSG_UNBOUND_MODE_DETECT); \ - \ - BUILD_ASSERT(UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_DISABLE || \ - IS_ENABLED(CONFIG_IPC_SERVICE_ICMSG_UNBOUND_DISABLED_ALLOWED), \ - "Unbound mode \"disabled\" is was forbidden in Kconfig."); \ - \ - BUILD_ASSERT(UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_ENABLE || \ - IS_ENABLED(CONFIG_IPC_SERVICE_ICMSG_UNBOUND_ENABLED_ALLOWED), \ - "Unbound mode \"enabled\" is was forbidden in Kconfig."); \ - \ - BUILD_ASSERT(UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_DETECT || \ - IS_ENABLED(CONFIG_IPC_SERVICE_ICMSG_UNBOUND_DETECT_ALLOWED), \ - "Unbound mode \"detect\" is was forbidden in Kconfig."); \ - \ - static struct icmsg_data_t backend_data_##i = { \ - .tx_pb = &tx_pb_##i, \ - .rx_pb = &rx_pb_##i, \ - }; \ - \ - DEVICE_DT_INST_DEFINE(i, \ - &backend_init, \ - NULL, \ - &backend_data_##i, \ - &backend_config_##i, \ - POST_KERNEL, \ - CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \ - &backend_ops); +#define DEFINE_BACKEND_DEVICE(i) \ + static const struct icmsg_config_t backend_config_##i = { \ + .mbox_tx = MBOX_DT_SPEC_INST_GET(i, tx), \ + .mbox_rx = MBOX_DT_SPEC_INST_GET(i, rx), \ + .unbound_mode = UNBOUND_MODE(i), \ + }; \ + \ + PBUF_DEFINE(tx_pb_##i, DT_REG_ADDR(DT_INST_PHANDLE(i, tx_region)), \ + DT_REG_SIZE(DT_INST_PHANDLE(i, tx_region)), \ + DT_INST_PROP_OR(i, dcache_alignment, 0), \ + UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_DISABLE, \ + UNBOUND_MODE(i) == ICMSG_UNBOUND_MODE_DETECT); \ + PBUF_DEFINE(rx_pb_##i, DT_REG_ADDR(DT_INST_PHANDLE(i, rx_region)), \ + DT_REG_SIZE(DT_INST_PHANDLE(i, rx_region)), \ + DT_INST_PROP_OR(i, dcache_alignment, 0), \ + UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_DISABLE, \ + UNBOUND_MODE(i) == ICMSG_UNBOUND_MODE_DETECT); \ + \ + BUILD_ASSERT(UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_DISABLE || \ + IS_ENABLED(CONFIG_IPC_SERVICE_ICMSG_UNBOUND_DISABLED_ALLOWED), \ + "Unbound mode \"disabled\" is was forbidden in Kconfig."); \ + \ + BUILD_ASSERT(UNBOUND_MODE(i) != ICMSG_UNBOUND_MODE_ENABLE || \ + IS_ENABLED(CONFIG_IPC_SERVICE_ICMSG_UNBOUND_ENABL
DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE)

/* TODO: REMOVE THIS WORKAROUND!!! */

static int workaround_ppr_reset(void)
{
#define _FIX_RESET_MEM(i) \
memset(&backend_data_##i, 0, sizeof(backend_data_##i)); \
backend_data_##i.tx_pb = &tx_pb_##i; \
backend_data_##i.rx_pb = &rx_pb_##i;
DT_INST_FOREACH_STATUS_OKAY(_FIX_RESET_MEM);
}

SYS_INIT(workaround_ppr_reset, PRE_KERNEL_1, 0);

0 comments on commit 313531d

Please sign in to comment.