scripts/dts: gen_defines: Generates _EXISTS for names and index macros

Add generation of the following macros:
DT_N_<node-id>_P_<prop-id>_NAME_<NAME>_EXISTS
DT_N_<node-id>_P_<prop-id>_IDX_<idx>_EXISTS
This will be useful to check availability of named or indexed
property like dmas/dma-names.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2020-04-06 14:56:11 +02:00 committed by Kumar Gala
parent f1977aebc4
commit 6c8617a5ed
2 changed files with 6 additions and 1 deletions

View file

@ -102,10 +102,11 @@ prop-id = dt-name
; - with array types (uint8-array, phandle-array, etc.)
; - with "enum:" in their bindings
; - zephyr device API specific macros for phandle-arrays
; - phandle specifier names ("foo-names")
;
; Here are some examples:
;
; - _EXISTS: property existence flag
; - _EXISTS: property, index or name existence flag
; - _SIZE: logical property length
; - _IDX_<i>: values of individual array elements
; - _IDX_<DIGIT>_VAL_<dt-name>: values of individual specifier

View file

@ -484,10 +484,14 @@ def controller_and_data_macros(entry, i, macro):
return ret
name = str2ident(entry.name)
# DT_N_<node-id>_P_<prop-id>_IDX_<i>_EXISTS
ret[f"{macro}_IDX_{i}_EXISTS"] = 1
# DT_N_<node-id>_P_<prop-id>_IDX_<i>_NAME
ret[f"{macro}_IDX_{i}_NAME"] = quote_str(entry.name)
# DT_N_<node-id>_P_<prop-id>_NAME_<NAME>_PH
ret[f"{macro}_NAME_{name}_PH"] = f"DT_{entry.controller.z_path_id}"
# DT_N_<node-id>_P_<prop-id>_NAME_<NAME>_EXISTS
ret[f"{macro}_NAME_{name}_EXISTS"] = 1
# DT_N_<node-id>_P_<prop-id>_NAME_<NAME>_VAL_<VAL>
for cell, val in data.items():
cell_ident = str2ident(cell)