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