Lines Matching full:macro

330     for macro, val in idx_vals:
331 out_dt_define(macro, val)
368 for macro, val in idx_vals:
369 out_dt_define(macro, val)
370 for macro, val in name_vals:
371 out_dt_define(macro, val)
379 # macro magic in devicetree.h?
436 for macro, val in idx_vals:
437 out_dt_define(macro, val)
438 for macro, val in name_vals:
439 out_dt_define(macro, val)
443 # Writes a macro for each of the node's compatibles. We don't care
569 macro = f"{node.z_path_id}_GPIO_HOGS"
572 macro2val.update(controller_and_data_macros(entry, i, macro))
576 out_dt_define(f"{macro}_EXISTS", 1)
577 out_dt_define(f"{macro}_NUM", len(node.gpio_hogs))
578 for macro, val in macro2val.items():
579 out_dt_define(macro, val)
596 macro = f"{node.z_path_id}_P_{prop_id}"
600 macro2val[macro] = val
603 macro2val.update(string_macros(macro, prop.val))
608 macro2val[f"{macro}_IDX_0"] = quote_str(prop.val)
609 macro2val[f"{macro}_IDX_0_EXISTS"] = 1
612 macro2val.update(enum_macros(prop, macro))
615 macro2val.update(phandle_macros(prop, macro))
617 macro2val.update(array_macros(prop, macro))
622 macro2val[f"{macro}_FOREACH_PROP_ELEM(fn)"] = (
627 macro2val[f"{macro}_FOREACH_PROP_ELEM_SEP(fn, sep)"] = (
633 macro2val[f"{macro}_FOREACH_PROP_ELEM_VARGS(fn, ...)"] = (
639 macro2val[f"{macro}_FOREACH_PROP_ELEM_SEP_VARGS(fn, sep, ...)"] = (
645 macro2val[f"{macro}_LEN"] = plen
648 macro2val[f"{macro}_EXISTS"] = 1
652 for macro, val in macro2val.items():
653 out_dt_define(macro, val)
658 def string_macros(macro: str, val: str):
660 # The 'macro' argument is the N_<node-id>_P_<prop-id>... part.
665 f"{macro}_STRING_UNQUOTED": escape_unquoted(val),
667 f"{macro}_STRING_TOKEN": as_token,
669 f"{macro}_STRING_UPPER_TOKEN": as_token.upper()}
672 def enum_macros(prop: edtlib.Property, macro: str):
674 # The 'macro' argument is the N_<node-id>_P_<prop-id> part.
678 ret = {f"{macro}_IDX_{i}_ENUM_IDX": index for i, index in enumerate(prop.enum_indices)}
683 ret[f"{macro}_IDX_{i}_EXISTS"] = 1
685 ret[f"{macro}_IDX_{i}_ENUM_VAL_{subval}_EXISTS"] = 1
690 def array_macros(prop: edtlib.Property, macro: str):
692 # The 'macro' argument is the N_<node-id>_P_<prop-id> part.
697 ret[f"{macro}_IDX_{i}_EXISTS"] = 1
701 ret[f"{macro}_IDX_{i}"] = quote_str(subval)
703 ret.update(string_macros(f"{macro}_IDX_{i}", subval))
705 ret[f"{macro}_IDX_{i}"] = subval
737 # Gets the macro value for property 'prop', if there is
762 # a _LEN macro for the property. Otherwise, returns None.
766 # make sure to update the doxygen string for that macro, and make
795 def phandle_macros(prop: edtlib.Property, macro: str) -> dict:
798 # The 'macro' argument is the N_<node-id>_P_<prop-id> bit.
812 ret[f"{macro}"] = f"DT_{prop.val.z_path_id}"
813 ret[f"{macro}_IDX_0"] = f"DT_{prop.val.z_path_id}"
814 ret[f"{macro}_IDX_0_PH"] = f"DT_{prop.val.z_path_id}"
815 ret[f"{macro}_IDX_0_EXISTS"] = 1
818 ret[f"{macro}_IDX_{i}"] = f"DT_{node.z_path_id}"
819 ret[f"{macro}_IDX_{i}_PH"] = f"DT_{node.z_path_id}"
820 ret[f"{macro}_IDX_{i}_EXISTS"] = 1
827 ret[f"{macro}_IDX_{i}_EXISTS"] = 0
830 ret.update(controller_and_data_macros(entry, i, macro))
835 def controller_and_data_macros(entry: edtlib.ControllerAndData, i: int, macro: str):
846 ret[f"{macro}_IDX_{i}_EXISTS"] = 1
848 ret[f"{macro}_IDX_{i}_PH"] = f"DT_{entry.controller.z_path_id}"
851 ret[f"{macro}_IDX_{i}_VAL_{str2ident(cell)}"] = val
852 ret[f"{macro}_IDX_{i}_VAL_{str2ident(cell)}_EXISTS"] = 1
859 ret[f"{macro}_IDX_{i}_EXISTS"] = 1
861 ret[f"{macro}_IDX_{i}_NAME"] = quote_str(entry.name)
863 ret[f"{macro}_NAME_{name}_PH"] = f"DT_{entry.controller.z_path_id}"
865 ret[f"{macro}_NAME_{name}_EXISTS"] = 1
869 ret[f"{macro}_NAME_{name}_VAL_{cell_ident}"] = (
870 f"DT_{macro}_IDX_{i}_VAL_{cell_ident}")
871 ret[f"{macro}_NAME_{name}_VAL_{cell_ident}_EXISTS"] = 1
885 for macro, value in chosen.items():
886 out_define(macro, value, width=max_len)
931 # conversion in the preprocessor helps to keep the macro
946 macro = f"COMPAT_{str2ident(compat)}_LABEL_{str2ident(label)}"
949 out_dt_define(macro, val)
950 out_dt_define(macro + "_EXISTS", 1)
958 for macro, value in n_okay_macros.items():
959 out_define(macro, value)
960 for macro, value in for_each_macros.items():
961 out_define(macro, value)
983 macro: str,
988 # Writes "#define DT_<macro> <val>" to the header file
990 # The macro will be left-justified to 'width' characters if that
993 # whitespace between 'macro' and 'val'.
998 # Returns the full generated macro for 'macro', with leading "DT_".
999 ret = f"DT_{macro}"
1005 macro: str,
1010 # Helper for out_dt_define(). Outputs "#define <macro> <val>",
1017 s = f"#define {macro.ljust(width)}{warn} {val}"
1019 s = f"#define {macro}{warn} {val}"