scripts: kconfigfunctions: Redefine dt_nodelabel_has_compat()
The function in its current form is confusing because unlike other similarly named functions (dt_nodelabel_has_prop(), dt_node_has_prop()) or devicetree macros (DT_NODE_HAS_COMPAT(), DT_NODE_HAS_PROP()), this function takes into account the status of the checked node and returns "y" only when the node is enabled. This commit redefines dt_nodelabel_has_compat() so that it no longer checks the node status, and for cases where the previous functionality is needed, a new function named dt_nodelabel_enabled_with_compat() is introduced as a replacement. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
9f2a27b3e0
commit
cd00a3a3c9
|
@ -37,6 +37,7 @@ while the ``*_hex`` version returns a hexadecimal value starting with ``0x``.
|
|||
$(dt_path_enabled,<node path>)
|
||||
$(dt_alias_enabled,<node alias>)
|
||||
$(dt_nodelabel_enabled,<node label>)
|
||||
$(dt_nodelabel_enabled_with_compat,<node label>,<compatible string>)
|
||||
$(dt_chosen_reg_addr_int,<property in /chosen>[,<index>,<unit>])
|
||||
$(dt_chosen_reg_addr_hex,<property in /chosen>[,<index>,<unit>])
|
||||
$(dt_chosen_reg_size_int,<property in /chosen>[,<index>,<unit>])
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config ITE_IT8XXX2_INTC
|
||||
def_bool $(dt_nodelabel_has_compat,intc,it8xxx2-intc)
|
||||
def_bool $(dt_nodelabel_enabled_with_compat,intc,it8xxx2-intc)
|
||||
depends on (SOC_IT8XXX2)
|
||||
help
|
||||
Configures the maximum number of clients allowed per shared
|
||||
|
|
|
@ -16,7 +16,7 @@ if UART_RTT
|
|||
DT_COMPAT_SEGGER_RTT_UART := segger,rtt-uart
|
||||
|
||||
config UART_RTT_0
|
||||
def_bool $(dt_nodelabel_has_compat,rtt0,$(DT_COMPAT_SEGGER_RTT_UART))
|
||||
def_bool $(dt_nodelabel_enabled_with_compat,rtt0,$(DT_COMPAT_SEGGER_RTT_UART))
|
||||
depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 1 && SEGGER_RTT_MAX_NUM_DOWN_BUFFERS >= 1
|
||||
depends on SEGGER_RTT_MODE_NO_BLOCK_SKIP
|
||||
select SERIAL_HAS_DRIVER
|
||||
|
@ -25,7 +25,7 @@ config UART_RTT_0
|
|||
Enable UART on (default) RTT channel 0. Default channel has to be configured in non-blocking skip mode.
|
||||
|
||||
config UART_RTT_1
|
||||
def_bool $(dt_nodelabel_has_compat,rtt1,$(DT_COMPAT_SEGGER_RTT_UART))
|
||||
def_bool $(dt_nodelabel_enabled_with_compat,rtt1,$(DT_COMPAT_SEGGER_RTT_UART))
|
||||
depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 2 && SEGGER_RTT_MAX_NUM_DOWN_BUFFERS >= 2
|
||||
select SERIAL_HAS_DRIVER
|
||||
select UART_RTT_DRIVER
|
||||
|
@ -33,7 +33,7 @@ config UART_RTT_1
|
|||
Enable UART on RTT channel 1
|
||||
|
||||
config UART_RTT_2
|
||||
def_bool $(dt_nodelabel_has_compat,rtt2,$(DT_COMPAT_SEGGER_RTT_UART))
|
||||
def_bool $(dt_nodelabel_enabled_with_compat,rtt2,$(DT_COMPAT_SEGGER_RTT_UART))
|
||||
depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 3 && SEGGER_RTT_MAX_NUM_DOWN_BUFFERS >= 3
|
||||
select SERIAL_HAS_DRIVER
|
||||
select UART_RTT_DRIVER
|
||||
|
@ -41,7 +41,7 @@ config UART_RTT_2
|
|||
Enable UART on RTT channel 2
|
||||
|
||||
config UART_RTT_3
|
||||
def_bool $(dt_nodelabel_has_compat,rtt3,$(DT_COMPAT_SEGGER_RTT_UART))
|
||||
def_bool $(dt_nodelabel_enabled_with_compat,rtt3,$(DT_COMPAT_SEGGER_RTT_UART))
|
||||
depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 4 && SEGGER_RTT_MAX_NUM_DOWN_BUFFERS >= 4
|
||||
select SERIAL_HAS_DRIVER
|
||||
select UART_RTT_DRIVER
|
||||
|
|
|
@ -497,6 +497,23 @@ def dt_compat_on_bus(kconf, _, compat, bus):
|
|||
|
||||
|
||||
def dt_nodelabel_has_compat(kconf, _, label, compat):
|
||||
"""
|
||||
This function takes a 'label' and looks for an EDT node with that label.
|
||||
If it finds such node, it returns "y" if this node is compatible with
|
||||
the provided 'compat'. Otherwise, it return "n" .
|
||||
"""
|
||||
if doc_mode or edt is None:
|
||||
return "n"
|
||||
|
||||
node = edt.label2node.get(label)
|
||||
|
||||
if node and compat in node.compats:
|
||||
return "y"
|
||||
|
||||
return "n"
|
||||
|
||||
|
||||
def dt_nodelabel_enabled_with_compat(kconf, _, label, compat):
|
||||
"""
|
||||
This function takes a 'label' and returns "y" if an "enabled" node with
|
||||
such label can be found in the EDT and that node is compatible with the
|
||||
|
@ -560,6 +577,7 @@ functions = {
|
|||
"dt_path_enabled": (dt_node_enabled, 1, 1),
|
||||
"dt_alias_enabled": (dt_node_enabled, 1, 1),
|
||||
"dt_nodelabel_enabled": (dt_nodelabel_enabled, 1, 1),
|
||||
"dt_nodelabel_enabled_with_compat": (dt_nodelabel_enabled_with_compat, 2, 2),
|
||||
"dt_chosen_reg_addr_int": (dt_chosen_reg, 1, 3),
|
||||
"dt_chosen_reg_addr_hex": (dt_chosen_reg, 1, 3),
|
||||
"dt_chosen_reg_size_int": (dt_chosen_reg, 1, 3),
|
||||
|
|
Loading…
Reference in a new issue