kconfig: kconfigfunctions: Add dt_str_val function

Add dt_str_val to extract a string from the dt conf database.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2019-02-08 08:25:21 -06:00 committed by Kumar Gala
commit 2579adea1e
2 changed files with 14 additions and 0 deletions

View file

@ -637,6 +637,10 @@ Device Tree Related Functions
'm' or 'M' divide by 1,048,576 (1 << 20) 'm' or 'M' divide by 1,048,576 (1 << 20)
'g' or 'G' divide by 1,073,741,824 (1 << 30) 'g' or 'G' divide by 1,073,741,824 (1 << 30)
dt_str_val(kconf, _, name):
This function looks up 'name' in the DTS generated "conf" style database
and if its found it will return the value as string.
Example Usage Example Usage
============= =============

View file

@ -76,8 +76,18 @@ def dt_hex_val(kconf, _, name, unit=None):
return hex(d) return hex(d)
def dt_str_val(kconf, _, name):
"""
This function looks up 'name' in the DTS generated "conf" style database
and if its found it will return the value as string.
"""
if doc_mode or name not in dt_defines:
return ""
return dt_defines[name].strip('\"')
functions = { functions = {
"dt_int_val": (dt_int_val, 1, 2), "dt_int_val": (dt_int_val, 1, 2),
"dt_hex_val": (dt_hex_val, 1, 2), "dt_hex_val": (dt_hex_val, 1, 2),
"dt_str_val": (dt_str_val, 1, 1),
} }