From d877e1dded5482b30173c18baab89fae571ee7db Mon Sep 17 00:00:00 2001 From: Emil Obalski Date: Thu, 24 Mar 2022 11:50:53 +0100 Subject: [PATCH] ipc_service: Automatically include source files for backends The purpose of this change is to allow to enable more than one backend at once by removing choice from ipc-service backend Kconfig and depending backend Kconfig option on existing of correct compatible. Overwriting IPC_SERVICE_BACKEND option in some places is removes as no longer needed. Signed-off-by: Emil Obalski --- drivers/bluetooth/hci/Kconfig | 8 ----- include/ipc/ipc_rpmsg.h | 2 +- modules/hal_nordic/Kconfig | 4 --- subsys/ipc/ipc_service/backends/Kconfig | 30 +++++++------------ subsys/ipc/ipc_service/backends/Kconfig.rpmsg | 9 +++++- 5 files changed, 19 insertions(+), 34 deletions(-) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index b9f55c4b2a4..06e9c4b8e19 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -39,14 +39,6 @@ config BT_RPMSG Bluetooth HCI driver for communication with another CPU using RPMsg framework. -if BT_RPMSG - -choice IPC_SERVICE_BACKEND - default IPC_SERVICE_BACKEND_RPMSG -endchoice - -endif # BT_RPMSG - config BT_SPI bool "SPI HCI" depends on SPI diff --git a/include/ipc/ipc_rpmsg.h b/include/ipc/ipc_rpmsg.h index 2a6abaf38da..4f92b02732b 100644 --- a/include/ipc/ipc_rpmsg.h +++ b/include/ipc/ipc_rpmsg.h @@ -22,7 +22,7 @@ extern "C" { */ /** Number of endpoints. */ -#define NUM_ENDPOINTS CONFIG_IPC_SERVICE_NUM_ENDPOINTS_PER_INSTANCE +#define NUM_ENDPOINTS CONFIG_IPC_SERVICE_BACKEND_RPMSG_NUM_ENDPOINTS_PER_INSTANCE struct ipc_rpmsg_ept; diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index f5978aaca79..602dde5b521 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -179,10 +179,6 @@ endif menu "nRF 802.15.4 serialization" depends on NRF_802154_SER_HOST || NRF_802154_SER_RADIO -choice IPC_SERVICE_BACKEND - default IPC_SERVICE_BACKEND_RPMSG -endchoice - config NRF_802154_SER_LOG bool "802.15.4 serialization logs" default n diff --git a/subsys/ipc/ipc_service/backends/Kconfig b/subsys/ipc/ipc_service/backends/Kconfig index f36ec11e615..08035c6d062 100644 --- a/subsys/ipc/ipc_service/backends/Kconfig +++ b/subsys/ipc/ipc_service/backends/Kconfig @@ -1,12 +1,19 @@ # Copyright (c) 2021 Nordic Semiconductor (ASA) # SPDX-License-Identifier: Apache-2.0 -choice IPC_SERVICE_BACKEND - prompt "IPC service backend" +DT_COMPAT_ZEPHYR_IPC_OPENAMP_STATIC_VRINGS := zephyr,ipc-openamp-static-vrings +DT_COMPAT_ZEPHYR_IPC_ICMSG := zephyr,ipc-icmsg + +config IPC_SERVICE_REG_BACKEND_PRIORITY + int "Initialization priority of modules registering IPC backend" + default 46 + help + The backend must be registered before the endpoint register. config IPC_SERVICE_BACKEND_RPMSG bool "OpenAMP RPMSG backend with static VRINGs" depends on MBOX + default $(dt_compat_enabled,$(DT_COMPAT_ZEPHYR_IPC_OPENAMP_STATIC_VRINGS)) select IPC_SERVICE_RPMSG select IPC_SERVICE_STATIC_VRINGS select OPENAMP @@ -14,29 +21,12 @@ config IPC_SERVICE_BACKEND_RPMSG config IPC_SERVICE_BACKEND_ICMSG bool "ICMSG backend with ICMsg buffer" depends on MBOX + default $(dt_compat_enabled,$(DT_COMPAT_ZEPHYR_IPC_ICMSG)) select IPC_SERVICE_ICMSG_BUF help Chosing this backend results in single endpoint implementation based on ringbuf. -config IPC_SERVICE_BACKEND_ZTEST - depends on ZTEST - bool "IPC service backend test" - -endchoice - -config IPC_SERVICE_NUM_ENDPOINTS_PER_INSTANCE - int "Max number of registered endpoints per instance" - default 2 - help - Maximal number of endpoints that can be registered for one instance. - -config IPC_SERVICE_REG_BACKEND_PRIORITY - int "Initialization priority of modules registering IPC backend" - default 46 - help - The backend must be registered before the endpoint register. - config IPC_SERVICE_RPMSG bool "RPMsg support library" help diff --git a/subsys/ipc/ipc_service/backends/Kconfig.rpmsg b/subsys/ipc/ipc_service/backends/Kconfig.rpmsg index 7bff068fd49..98c9380211f 100644 --- a/subsys/ipc/ipc_service/backends/Kconfig.rpmsg +++ b/subsys/ipc/ipc_service/backends/Kconfig.rpmsg @@ -21,4 +21,11 @@ config IPC_SERVICE_BACKEND_RPMSG_SHMEM_RESET When this parameter is set to 'y' the status region of the shared memory is reset on kernel initialization. -endif # IP_SERVICE_BACKEND_RPMSG +config IPC_SERVICE_BACKEND_RPMSG_NUM_ENDPOINTS_PER_INSTANCE + int "Max number of registered endpoints per instance" + default 2 + help + Maximal number of endpoints that can be registered for one instance + for RPMSG backend. + +endif # IPC_SERVICE_BACKEND_RPMSG