diff --git a/doc/guides/build/kconfig/preprocessor-functions.rst b/doc/guides/build/kconfig/preprocessor-functions.rst index f73ce362484..3e7914da239 100644 --- a/doc/guides/build/kconfig/preprocessor-functions.rst +++ b/doc/guides/build/kconfig/preprocessor-functions.rst @@ -38,8 +38,10 @@ while the ``*_hex`` version returns a hexadecimal value starting with ``0x``. $(dt_node_reg_size_hex,[,,]) $(dt_compat_enabled,) $(dt_chosen_enabled,) - $(dt_node_has_bool_prop,,) + $(dt_node_bool_prop,,) + $(dt_nodelabel_bool_prop,,) $(dt_node_has_prop,,) + $(dt_nodelabel_has_prop,,) Example Usage diff --git a/drivers/counter/Kconfig.nrfx b/drivers/counter/Kconfig.nrfx index ed37bcfcbae..42224df7020 100644 --- a/drivers/counter/Kconfig.nrfx +++ b/drivers/counter/Kconfig.nrfx @@ -97,14 +97,14 @@ config COUNTER_RTC2_ZLI # Internal flag which detects if PPI wrap feature is enabled for any instance config COUNTER_RTC_WITH_PPI_WRAP - def_bool ($(dt_node_has_bool_prop,rtc-0,ppi-wrap) && COUNTER_RTC0) || \ - ($(dt_node_has_bool_prop,rtc-1,ppi-wrap) && COUNTER_RTC1) || \ - ($(dt_node_has_bool_prop,rtc-2,ppi-wrap) && COUNTER_RTC2) + def_bool ($(dt_node_bool_prop,rtc-0,ppi-wrap) && COUNTER_RTC0) || \ + ($(dt_node_bool_prop,rtc-1,ppi-wrap) && COUNTER_RTC1) || \ + ($(dt_node_bool_prop,rtc-2,ppi-wrap) && COUNTER_RTC2) select NRFX_PPI if HAS_HW_NRF_PPI select NRFX_DPPI if HAS_HW_NRF_DPPIC # Internal flag which detects if fixed top feature is enabled for any instance config COUNTER_RTC_CUSTOM_TOP_SUPPORT - def_bool (!$(dt_node_has_bool_prop,rtc-0,fixed-top) && COUNTER_RTC0) || \ - (!$(dt_node_has_bool_prop,rtc-1,fixed-top) && COUNTER_RTC1) || \ - (!$(dt_node_has_bool_prop,rtc-2,fixed-top) && COUNTER_RTC2) + def_bool (!$(dt_node_bool_prop,rtc-0,fixed-top) && COUNTER_RTC0) || \ + (!$(dt_node_bool_prop,rtc-1,fixed-top) && COUNTER_RTC1) || \ + (!$(dt_node_bool_prop,rtc-2,fixed-top) && COUNTER_RTC2) diff --git a/drivers/flash/Kconfig.stm32_qspi b/drivers/flash/Kconfig.stm32_qspi index ba28bb676c2..95762d8a0e4 100644 --- a/drivers/flash/Kconfig.stm32_qspi +++ b/drivers/flash/Kconfig.stm32_qspi @@ -5,7 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 DT_COMPAT_ST_STM32_QSPI_NOR := st,stm32-qspi-nor -DT_STM32_QUADSPI_HAS_DMA := $(dt_node_has_prop,quadspi,dmas) +DT_STM32_QUADSPI_HAS_DMA := $(dt_nodelabel_has_prop,quadspi,dmas) config FLASH_STM32_QSPI bool "STM32 Quad SPI Flash driver" diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index 19cdc499f1e..3db55e369a1 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -310,19 +310,15 @@ def dt_node_reg(kconf, name, path, index=0, unit=None): if name == "dt_node_reg_addr_hex": return hex(_dt_node_reg_addr(kconf, path, index, unit)) - -def dt_node_has_bool_prop(kconf, _, path, prop): +def _dt_node_bool_prop_generic(node_search_function, search_arg, prop): """ - This function takes a 'path' and looks for an EDT node at that path. If it - finds an EDT node, it will look to see if that node has a boolean property - by the name of 'prop'. If the 'prop' exists it will return "y" otherwise - we return "n". + This function takes the 'node_search_function' and uses it to search for + a node with 'search_arg' and if node exists, checks if 'prop' exists + inside the node and is a boolean, if it is true, returns "y". + Otherwise, it returns "n". """ - if doc_mode or edt is None: - return "n" - try: - node = edt.get_node(path) + node = node_search_function(search_arg) except edtlib.EDTError: return "n" @@ -337,19 +333,38 @@ def dt_node_has_bool_prop(kconf, _, path, prop): return "n" -def dt_node_has_prop(kconf, _, label, prop): +def dt_node_bool_prop(kconf, _, path, prop): """ - This function takes a 'label' and looks for an EDT node for that label. If - it finds an EDT node, it will look to see if that node has a property + This function takes a 'path' and looks for an EDT node at that path. If it + finds an EDT node, it will look to see if that node has a boolean property by the name of 'prop'. If the 'prop' exists it will return "y" otherwise we return "n". """ - if doc_mode or edt is None: return "n" + return _dt_node_bool_prop_generic(edt.get_node, path, prop) + +def dt_nodelabel_bool_prop(kconf, _, label, prop): + """ + This function takes a 'label' and looks for an EDT node with that label. + If it finds an EDT node, it will look to see if that node has a boolean + property by the name of 'prop'. If the 'prop' exists it will return "y" + otherwise we return "n". + """ + if doc_mode or edt is None: + return "n" + + return _dt_node_bool_prop_generic(edt.label2node.get, label, prop) + +def _dt_node_has_prop_generic(node_search_function, search_arg, prop): + """ + This function takes the 'node_search_function' and uses it to search for + a node with 'search_arg' and if node exists, then checks if 'prop' + exists inside the node and returns "y". Otherwise, it returns "n". + """ try: - node = edt.label2node.get(label) + node = node_search_function(search_arg) except edtlib.EDTError: return "n" @@ -361,6 +376,30 @@ def dt_node_has_prop(kconf, _, label, prop): return "n" +def dt_node_has_prop(kconf, _, path, prop): + """ + This function takes a 'path' and looks for an EDT node at that path. If it + finds an EDT node, it will look to see if that node has a property + by the name of 'prop'. If the 'prop' exists it will return "y" otherwise + it returns "n". + """ + if doc_mode or edt is None: + return "n" + + return _dt_node_has_prop_generic(edt.get_node, path, prop) + +def dt_nodelabel_has_prop(kconf, _, label, prop): + """ + This function takes a 'label' and looks for an EDT node with that label. + If it finds an EDT node, it will look to see if that node has a property + by the name of 'prop'. If the 'prop' exists it will return "y" otherwise + it returns "n". + """ + if doc_mode or edt is None: + return "n" + + return _dt_node_has_prop_generic(edt.label2node.get, label, prop) + def dt_node_int_prop(kconf, name, path, prop, unit=None): """ This function takes a 'path' and property name ('prop') looks for an EDT @@ -513,8 +552,10 @@ functions = { "dt_node_reg_addr_hex": (dt_node_reg, 1, 3), "dt_node_reg_size_int": (dt_node_reg, 1, 3), "dt_node_reg_size_hex": (dt_node_reg, 1, 3), - "dt_node_has_bool_prop": (dt_node_has_bool_prop, 2, 2), + "dt_node_bool_prop": (dt_node_bool_prop, 2, 2), + "dt_nodelabel_bool_prop": (dt_nodelabel_bool_prop, 2, 2), "dt_node_has_prop": (dt_node_has_prop, 2, 2), + "dt_nodelabel_has_prop": (dt_nodelabel_has_prop, 2, 2), "dt_node_int_prop_int": (dt_node_int_prop, 2, 3), "dt_node_int_prop_hex": (dt_node_int_prop, 2, 3), "dt_node_str_prop_equals": (dt_node_str_prop_equals, 3, 3), diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 90f8c57806e..6a9808977b3 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -6,7 +6,7 @@ if BT_LL_SW_SPLIT DT_PATH_NORDIC_RADIO := $(dt_nodelabel_path,radio) -DT_NORDIC_RADIO_DFE_SUPPORTED := $(dt_node_has_bool_prop,$(DT_PATH_NORDIC_RADIO),dfe-supported) +DT_NORDIC_RADIO_DFE_SUPPORTED := $(dt_node_bool_prop,$(DT_PATH_NORDIC_RADIO),dfe-supported) config BT_LLL_VENDOR_NORDIC bool "Use Nordic LLL"