Home | History | Annotate | Line # | Download | only in ppc
      1  1.1  christos /*  This file is part of the program psim.
      2  1.1  christos 
      3  1.1  christos     Copyright (C) 1994-1996, Andrew Cagney <cagney (at) highland.com.au>
      4  1.1  christos 
      5  1.1  christos     This program is free software; you can redistribute it and/or modify
      6  1.1  christos     it under the terms of the GNU General Public License as published by
      7  1.1  christos     the Free Software Foundation; either version 3 of the License, or
      8  1.1  christos     (at your option) any later version.
      9  1.1  christos 
     10  1.1  christos     This program is distributed in the hope that it will be useful,
     11  1.1  christos     but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  1.1  christos     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  1.1  christos     GNU General Public License for more details.
     14  1.1  christos 
     15  1.1  christos     You should have received a copy of the GNU General Public License
     16  1.1  christos     along with this program; if not, see <http://www.gnu.org/licenses/>.
     17  1.1  christos 
     18  1.1  christos     */
     19  1.1  christos 
     20  1.1  christos 
     21  1.1  christos #ifndef _TREE_H_
     22  1.1  christos #define _TREE_H_
     23  1.1  christos 
     24  1.1  christos #ifndef INLINE_TREE
     25  1.1  christos #define INLINE_TREE
     26  1.1  christos #endif
     27  1.1  christos 
     28  1.1  christos /* Constructing the device tree:
     29  1.1  christos 
     30  1.1  christos    The initial device tree populated with devices and basic properties
     31  1.1  christos    is created using the function <<device_tree_add_parsed()>>.  This
     32  1.1  christos    function parses a PSIM device specification and uses it to populate
     33  1.1  christos    the tree accordingly.
     34  1.1  christos 
     35  1.1  christos    This function accepts a printf style formatted string as the
     36  1.1  christos    argument that describes the entry.  Any properties or interrupt
     37  1.1  christos    connections added to a device tree using this function are marked
     38  1.7  christos    as having a permanent disposition.  When the tree is (re)
     39  1.1  christos    initialized they will be restored to their initial value.
     40  1.1  christos 
     41  1.1  christos    */
     42  1.1  christos 
     43  1.1  christos EXTERN_TREE\
     44  1.1  christos (char*) tree_quote_property
     45  1.1  christos (const char *property_value);
     46  1.1  christos 
     47  1.1  christos EXTERN_TREE\
     48  1.1  christos (device *) tree_parse
     49  1.1  christos (device *root,
     50  1.1  christos  const char *fmt,
     51  1.6  christos  ...) ATTRIBUTE_PRINTF_2;
     52  1.1  christos 
     53  1.1  christos 
     54  1.1  christos INLINE_TREE\
     55  1.1  christos (void) tree_usage
     56  1.1  christos (int verbose);
     57  1.1  christos 
     58  1.1  christos INLINE_TREE\
     59  1.1  christos (void) tree_print
     60  1.1  christos (device *root);
     61  1.1  christos 
     62  1.1  christos INLINE_TREE\
     63  1.1  christos (device_instance*) tree_instance
     64  1.1  christos (device *root,
     65  1.1  christos  const char *device_specifier);
     66  1.1  christos 
     67  1.1  christos 
     68  1.1  christos /* Tree traversal::
     69  1.1  christos 
     70  1.1  christos    The entire device tree can be traversed using the
     71  1.1  christos    <<device_tree_traverse()>> function.  The traversal can be in
     72  1.1  christos    either pre- or postfix order.
     73  1.1  christos 
     74  1.1  christos    */
     75  1.1  christos 
     76  1.1  christos typedef void (tree_traverse_function)
     77  1.1  christos      (device *device,
     78  1.1  christos       void *data);
     79  1.1  christos 
     80  1.1  christos INLINE_DEVICE\
     81  1.1  christos (void) tree_traverse
     82  1.1  christos (device *root,
     83  1.1  christos  tree_traverse_function *prefix,
     84  1.1  christos  tree_traverse_function *postfix,
     85  1.1  christos  void *data);
     86  1.1  christos 
     87  1.1  christos 
     88  1.1  christos /* Tree lookup::
     89  1.1  christos 
     90  1.1  christos    The function <<tree_find_device()>> will attempt to locate
     91  1.1  christos    the specified device within the tree.  If the device is not found a
     92  1.1  christos    NULL device is returned.
     93  1.1  christos 
     94  1.1  christos    */
     95  1.1  christos 
     96  1.1  christos INLINE_TREE\
     97  1.1  christos (device *) tree_find_device
     98  1.1  christos (device *root,
     99  1.1  christos  const char *path);
    100  1.1  christos 
    101  1.1  christos 
    102  1.1  christos INLINE_TREE\
    103  1.1  christos (const device_property *) tree_find_property
    104  1.1  christos (device *root,
    105  1.1  christos  const char *path_to_property);
    106  1.1  christos 
    107  1.1  christos INLINE_TREE\
    108  1.1  christos (int) tree_find_boolean_property
    109  1.1  christos (device *root,
    110  1.1  christos  const char *path_to_property);
    111  1.1  christos 
    112  1.1  christos INLINE_TREE\
    113  1.1  christos (signed_cell) tree_find_integer_property
    114  1.1  christos (device *root,
    115  1.1  christos  const char *path_to_property);
    116  1.1  christos 
    117  1.1  christos INLINE_TREE\
    118  1.1  christos (device_instance *) tree_find_ihandle_property
    119  1.1  christos (device *root,
    120  1.1  christos  const char *path_to_property);
    121  1.1  christos 
    122  1.1  christos INLINE_TREE\
    123  1.1  christos (const char *) tree_find_string_property
    124  1.1  christos (device *root,
    125  1.1  christos  const char *path_to_property);
    126  1.1  christos 
    127  1.1  christos 
    128  1.1  christos /* Initializing the created tree:
    129  1.1  christos 
    130  1.1  christos    Once a device tree has been created the <<device_tree_init()>>
    131  1.1  christos    function is used to initialize it.  The exact sequence of events
    132  1.1  christos    that occure during initialization are described separatly.
    133  1.1  christos 
    134  1.1  christos    */
    135  1.1  christos 
    136  1.1  christos INLINE_TREE\
    137  1.1  christos (void) tree_init
    138  1.1  christos (device *root,
    139  1.1  christos  psim *system);
    140  1.1  christos 
    141  1.1  christos 
    142  1.1  christos #endif /* _TREE_H_ */
    143