| # Copyright (c) 2018 Bobby Noelte |
| # SPDX-License-Identifier: Apache-2.0 |
| from extract.globals import * |
| from extract.directive import DTDirective |
| # @brief Manage compatible directives. |
| class DTCompatible(DTDirective): |
| # @brief Extract compatible |
| # @param node_address Address of node owning the |
| # @param yaml YAML definition for the owning node. |
| # @param prop compatible property name |
| # @param def_label Define label string of node owning the |
| def extract(self, node_address, yaml, prop, def_label): |
| compatible = reduced[node_address]['props'][prop] |
| if not isinstance(compatible, list): |
| compatible = [compatible, ] |
| for i, comp in enumerate(compatible): |
| compat_label = convert_string_to_label(str(comp)) |
| compat_defs = 'CONFIG_DT_COMPAT_' + compat_label |
| insert_defs(node_address, load_defs, {}) |
| # @brief Management information for compatible. |
| compatible = DTCompatible() |